Sep 29, 2022 07:33 AM
I am working with the Airtable API in GoLang and I am using this client.
I have 150 records. I am trying to fetch the first 50, then next 50 and so on.
I do this by sending the following HTTP request (with the help of the client):
/v0/appXXXXXXX/tblXXXXXXXcellFormat=string&offset=50&pageSize=50&sort%5B0%5D%5Bdirection%5D=asc&sort%5B0%5D%5Bfield%5D=Name&timeZone=Europe%2FLondo
n&userLocale=en-gb
Note the &offset=50. When I send this request I get the following error:
“error”:{“type”:“INVALID_OFFSET_VALUE”,“message”:“The value of offset 50 is invalid”
I have tried removing the offset parameter and it gets me the first 50, but how am I supposed to get the next 50!
Below is my Go code using Mehanizm’s Client:
Solved! Go to Solution.
Sep 29, 2022 08:13 AM
HI @Adam_Haffar1,
When you make a request that returns more than 100 records, the JSON data will contain an offset that you will use on the next call for the next 100 records
Then you add that offset to your query URL
fetch(
https://api.airtable.com/v0/${remoteBaseID}/${remoteTableID}?api_key=${apiKey}&offset=${offset}`)`
Sep 29, 2022 08:13 AM
HI @Adam_Haffar1,
When you make a request that returns more than 100 records, the JSON data will contain an offset that you will use on the next call for the next 100 records
Then you add that offset to your query URL
fetch(
https://api.airtable.com/v0/${remoteBaseID}/${remoteTableID}?api_key=${apiKey}&offset=${offset}`)`
Sep 29, 2022 09:34 AM
Thanks this worked!!