Hi,
Referring to our API Reference documentation you can add the count
query parameter to your request to list all your orders. By setting a large number to the upper limit to the number of items to retrieve you should be able to list all your orders in the response.
Hi,
By setting count
to any number larger than 100, I get the following response:
{'error': {'status': 400,
'reason': 'Bad Request',
'message': "Query parameter 'count' must be at most 100.",
'code': 'COMMON_BAD_PAYLOAD'}}
However thank you for your response, by referring to the API docs, I found that I can get the next page of 100 orders by setting the parameter viewtoken
to 100, 200, …
Hi,
Yes, there will be limits on the results ‘count’ depending on the endpoint. To aid you in the future, I have attached the below code that shows how you list your results.
# get first 100 orders
resp = requests.get('https://services.sentinel-hub.com/api/v1/dataimport/orders', headers=headers).json()
# print out the number of hits and the "links" field of the response
print(len(respr'...']))
respr'links']
# nextToken was "100" in the previous response
# so we use that as the "viewtoken" query parameter to get the next page
resp = requests.get('https://services.sentinel-hub.com/api/v1/dataimport/orders?viewtoken=100', headers=headers).json()
print(len(respr'...']))
respr'links']
Naturally, if you have fewer than 100 orders then you can change the viewtoken parameter to a lower number such as 10.
Hope that this code will be useful to you and others in the future.