Pagination in the api

If I request ‘<my_id>&usernames=richlv’ and ‘<my_id>&usernames=richlv’, the returned data is the same. does talk about the previous/next links, but the example uses “page=3” - what’s the use of that?

But if we use “_page” instead, as seen in the example response link, that returns different data.

I also couldn’t find information on how the values are sorted in pagination - for example, when requesting images, which images will be on the first page, which will be on the last?

1 Like

@chrisbeddow are able to provide any input here?

This is a mistake in the documentation, so we just corrected that now. The next page should always be retrieved from the headers, so for example in Python or Javascript by getting the API call (GET request) and then in the response looking for next.url in response.links.

Here’s a quick example in Python:

import json, requests

output = {"type":"FeatureCollection","features":[]}

client = 'xyz123'
bbox = '12.576566934585571,55.68679058375094,12.580493688583374,55.68822998644554'
url = ('{}&per_page=1000&sort_by=key&bbox={}').format(client,str(bbox))
r = requests.get(url)
data = r.json()
data_length = len(data['features'])
for f in data['features']:
while data_length == 1000:
    link = r.links['next']['url'] 
    r = requests.get(link)
    data = r.json()
    for f in data['features']:
    print("Total features: {}".format(len(output['features'])))
    data_length = len(data['features'])
with open('images.geojson', 'w') as outfile:
    json.dump(output, outfile)

Sounds great, thank you.

What does the _page parameter do then?

What about ordering of the entries, are they progressing from page to page - and if yes, how?

Can one gather all the image metadata for their uploads (let’s say to figure out the number captured/uploaded with a certain camera), and some time later only grab data for new uploads, without requesting all the previously retrieved ones?