Retrieving data using api but there is a default limit

Viewed 26

Hello I am new API user and I have a question.

I am using admin API of Thinkific platform and when I retrieve data of the users I can retrieve up to 25 user data.

import requests
import json
import pandas as pd
pd.set_option('display.max_columns', None)

response_API = requests.get('https://api.thinkific.com/api/public/v1/users', headers= 
{ 
"X-Auth-API-Key":"key",
"X-Auth-Subdomain":"key",
"Content-Type": "application/json"
})

data = response_API.text
parse_json = json.loads(data)

Although I don't set a limit, I can retrieve only 25 user.

Normally writing this link:

https://api.thinkific.com/api/public/v1/users?limit=25 

instead of

https://api.thinkific.com/api/public/v1/users 

brings me 25 user data and I expect having the full data since I do not set a limit in the url that I used inside requests.get

Can you help me to retrieve all data I have please?

1 Answers

I'm not a Thinkific user, but reading the documentation provided here, the default limit is 25. So when you create a get request without any limit, by default, it would only retrieve 25 users. To get all user data, you'd need to use pagination. To do this, you'd need to read the meta -> pagination attribute, and create multiple get requests with the ?page={i} parameter until i = total pages.

Hope this helps!

meta object

Related