The Spring Boot App has been deployed to Google Cloud Platform and is accessible at https://latestprice-5gzbj4bnla-et.a.run.app.
To interact with the application, you can make requests to the following endpoints:
GET /price
Returns the current price of a Lithium-ion-Battery from the url: https://www.metal.com/Lithium-ion-Battery/202303240001
request params:
{}
response:
{
"price" :"0.12"
}
success response:
Code : 200 OK
Error Response:
API will return 500 Internal Server Error response
{
"error": "Failed to retrieve price
}
{
"error": "Check the url entered"
}
Note:
-
This API follows the RestFul architecture and uses the PriceController and PriceService layer.
-
If we have requirement to store data in the future, then this code can be extended to add a repository layer.