Skip to main content
Solved

Using Offset Pagination to get multiple pages of records in GO

  • September 29, 2022
  • 2 replies
  • 21 views

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:

Best answer by Vivid-Squid

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}`)`

View original
Did this topic help you find an answer to your question?

2 replies

  • Inspiring
  • 532 replies
  • Answer
  • September 29, 2022

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}`)`


  • Author
  • New Participant
  • 2 replies
  • September 29, 2022
Vivid-Squid wrote:

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}`)`


Thanks this worked!!


Reply