Skip to main content

Get purchases by time range

How to obtain a purchases list filtering by dates tutorial

Before starting

Before making any call to Api Orders, it is necessary to obtain a valid OAuth access token.

Prerequisites!

You will need a valid OAuth access_token to be able to use the next endpoint! Please refer to our Authentication Guide to obtain one.

Get purchase orders filtering by a date range

The following example Postman Curl, show a call to api-orders that returns a list of purchase type orders filtered by a range of dates passing the following parameters:

  • purchase_date_from: This parameter indicates the exact date and time from when the purchase orders should be returned.
  • purchase_date_to: This parameter indicates the exact date and time until when the purchase orders must be returned, ending then the time range.
  • type: This parameter indicates the type of orders that must be returned, in this case only orders of the PURCHASE type will be returned.
curl --location --request GET 'http://gateway-pre.oneboxtickets.net/orders-mgmt-api/v1/orders?purchase_date_from=2021-03-08T00:00:00Z&purchase_date_to=2021-03-09T00:00:00Z&type=PURCHASE' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{access_token}}'

Notes:

  • Please, note that dates must be submitted in the following format: 2021-03-08T00:00:00Z, otherwise the validation will fail.
  • The Api automatically makes an adjustment for the time zone difference. It returns the time in UTC and it can indicate that difference in the date of the response in this way 2020-12-21T19:00:00.000+01:00, where +01:00 is the time zone difference, this must be taken into account when filtering by dates since it can cause that some operations fall outside of the indicated date range due to this difference.