Skip to main content

Retrieve Public Price Trends

GET /api/v1/price-trends/public

Description

Retrieves a list of public price trends, allowing for detailed analysis based on product types, date ranges, and other filtering criteria. This endpoint supports extensive filtering and sorting to provide tailored insights into market trends and price fluctuations.

Query Parameters:

  • priceTrendDateRange (optional): Filters the price trends by a specific date range. Format: start_date,end_date (e.g., 2020-11-12,2022-11-15).
  • priceTrendByproductTypeIds (optional): Filters the price trends based on product type IDs.
  • priceTrendIds (optional): Filters the price trends based on specific price trend IDs.
  • order (optional): Specifies the order of the results. Available values: ASC, DESC.
  • page (optional): Specifies the pagination page.
  • limit (optional): Specifies the number of results per page.

Example Request:

curl -G "http://[base_url]/api/v1/price-trends/public" \
-d "priceTrendDateRange=2020-11-12,2022-11-15" \
-d "priceTrendByproductTypeIds=101,102" \
-d "priceTrendIds=201,202" \
-d "order=DESC" \
-d "page=1" \
-d "limit=10"

Responses:

  • 200 OK: Successfully retrieved the list of public price trends. The response includes detailed information about each trend that matches the filter criteria.

Example Response:

{
"priceTrends": [
{
"id": 201,
"productTypeId": 101,
"marketPrice": 150.00,
"date": "2021-12-15",
"productTypeName": "Wheat",
"unit": "tons",
"currency": "USD"
},
{
"id": 202,
"productTypeId": 102,
"marketPrice": 300.00,
"date": "2021-12-16",
"productTypeName": "Corn",
"unit": "tons",
"currency": "USD"
}
],
"totalItems": 20,
"totalPages": 2,
"currentPage": 1
}

Error Responses:

  • 400 Bad Request: Incorrect or incomplete query parameters.
  • 404 Not Found: No price trends found based on the provided criteria.

LANGUAGE

AUTHORIZATION

Bearer

CURL REQUEST


curl --request GET \ 
--url /api/v1/price-trends/public \
--header 'accept: application/json' \
--header 'content-type: application/json'

RESPONSE


Click Try It! to start a request and see the response here!