Help

How do I send the offset request?

Solved
Jump to Solution
3169 6
cancel
Showing results for 
Search instead for 
Did you mean: 
ids
5 - Automation Enthusiast
5 - Automation Enthusiast

I've seen this question, but not the type of answer I'm hoping for. A CURL example is a great for me to translate the request. Similar to the CURL examples in the docs for List Records, it looks like I should be able to request records 101-200 using the offset value returned in the original request. The docs say it's a Query, therefore:

 

...?offset=itrvDOnB9cbRDnn63/rec1VA0JPORC2S9Zz

 

It's not working. I haven't inspected the returned headers yet. 

So the questions:

-- should the request be RAW or POST?

--should/could the request be a JSON payload instead of querystring params?

 

I need to retrieve thousands of records. My follow up question for data from a different table, USING JSON Payloads can I somehow filter fields? There are many fields I really don't want to process on my end.

Thanks,

Scott

IDS

 

PS: I plan on using POSTMAN for testing.

1 Solution

Accepted Solutions
TheTimeSavingCo
18 - Pluto
18 - Pluto

It's a GET and it's part of your query params, here's an example:

https://api.airtable.com/v0/appz6YcyO3dqDWV/tblsCy3oC7N7FE4c?offset=itrloILUxLWba21F/recreX96bXOkThVj

To filter fields, use the `fields` query param

https://airtable.com/developers/web/api/list-records

See Solution in Thread

6 Replies 6
TheTimeSavingCo
18 - Pluto
18 - Pluto

It's a GET and it's part of your query params, here's an example:

https://api.airtable.com/v0/appz6YcyO3dqDWV/tblsCy3oC7N7FE4c?offset=itrloILUxLWba21F/recreX96bXOkThVj

To filter fields, use the `fields` query param

https://airtable.com/developers/web/api/list-records

ids
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank You.

I have been using GET and the same formatting. trying a POST was just a test of sorts. Also changed to using the Table Name instead of the ID. Same result. I finally did an inspection of the returned Headers:

 

HTTP/1.1 422 Unprocessable Entity
Date: Fri, 29 Mar 2024 05:44:26 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 56
Connection: close

 

What is the error: 422 Unprocessable Entity for this call?

https://api.airtable.com/v0/applpByfqnul0sn21/tblUxVun7fwac4OpJ?offset=itrHj5qqR9DmV2LVn/rec1VA0JPORC2S9Zz

My experience in other APIs, this error might indicate a bad token. Or, a session has closed and I can't access the data I was attempting to lookup. Is that possible with the offset record/string?

Thanks,

Scott

IDS

Yeap that's possible, and if so the body of the response says something like LIST ITERATOR NOT FOUND or something like that.  What was the body of the 422 you got? 

ids
5 - Automation Enthusiast
5 - Automation Enthusiast

Yes, that error is in the body.

 

 

{"error":{"type":"LIST_RECORDS_ITERATOR_NOT_AVAILABLE"}}

 

 

Is this because of the offset? Solutions?

Found partial answer: I realized what I was looking at in the doc page for list records. 422 is a timeout of sorts.

What is the timeout for this session?

IOW, When the 1st session retrieves the first 100 records with the "offset" string, how long is that window open to retrieve the next 100 records? 60 seconds? 120 seconds? Something different?

 

Scott

IDS

The offset's timed out I reckon; if you do the call again and try the new offset it should work fine.  I'm not sure how long the window is I'm afraid

ids
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks Adam. I was able to get this working as expected. I had been restarting the script after getting the offset values. My fix was capturing the offset value real time and running the API call again, essentially looping through until all the rows, 100 per, were retrieved or when no offset value was returned.