REST API using marker for next page

Viewed 76

(newbie here) I'm having problem to get next page from API which is using marker. My code is working fine, but I need it more flexible, because marker can change in any time.

For example, can I fetch marker from first call and then put it to the url for next page?

Do you have any suggestions? Thanks!

Code:

add = ['','?marker=34444424242424']
API_TOKEN = 'fake-token-1234'

headers = {
  'Content-Type': 'application/json',
  'Accepts': 'aplication/json',
  'Authorization': API_TOKEN,
}
for i in add:
  url ='https://api.site/v1/data/9bc6d3ef-0b9a-475b-981b-39f350e2323/responses{}'.format(i)
  r = requests.get(url,headers = headers)
  print(r.json())
0 Answers
Related