Help

Re: JSON string only contains 100 rows when connected to Power BI Desktop

6510 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Laura_Viar
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello,
I’m attempting to integrate Airtable and Power BI to create reports. Using the API authentication key, I am able to connect to one of my tables in Power BI. However, the JSON string only contains 100 rows when connected.

A more complete explanation of this issue is covered in this short tutorial and subsequent comments:

Airtable and Power BI - mpolino.com

Warning, this may be long and boring, but I need to write it down. The next Lizard Wong book is finally, finally, moving along nicely. For a while I’ve tracked my writing and word count using Wordly, an iPhone app. It works well enough, but at some...

Any ideas for resolving this?

Thanks! - Meg

13 Replies 13
Tuur
10 - Mercury
10 - Mercury

Hi Meg,

The API only gives you 100 rows by default. This is from the docs:

Pagination

The server returns one page of records at a time. Each page will contain pageSize records, which is 100 by default.

If there are more records, the response will contain an offset. To fetch the next page of records, include offset in the next request’s parameters.

Iteration may timeout due to client inactivity or server restarts. In that case, the client will receive a 422 response with error message LIST_RECORDS_ITERATOR_NOT_AVAILABLE. It may then restart iteration from the beginning.

Hi Tuur,

Can you give me a step by step approach as to solving this issue.
I am also facing the following problem. I have connected Power BI to my Airtable CRM via the JSON API. Now only 100 records are displayed. Which steps do I take in order to be able to view the addition ±300 items in Power BI?

Thanks a lot.

Best,

Tom

Hi @Tom_Luttikhuis!

Unfortunately I don’t have a clue how that works with Power BI. In my requests I simply add the offset. That would be something like adding ‘&offset=XXX’ to the request URL. You’ll find the correct offset in the JSON with the first 100 records.

Hope this helps. :slightly_smiling_face:

BTW: there are other posts here that might help you…

For example:

Here’s the best my Google-foo could find. It appears to be a non-negligible tasks.

Mo_re
4 - Data Explorer
4 - Data Explorer

Hello! Little bit late to the party, but I got Power BI to fetch the paginated Airtable pages. What has not been implemented yet is a timout to avoid sending too many requests. Here’s the “Power Query” you’ll need:

let
    Pagination = List.Skip(List.Generate( () => [Last_Key = "init", Counter=0], // Start Value
   		each  [Last_Key] <> null, // Condition under which the next execution will happen
   		each [ Last_Key = try if [Counter]<1 then "" else [WebCall][Value][offset] otherwise null,// determine the LastKey for the next execution
                       WebCall = try if [Counter]<1 then Json.Document(Web.Contents("https://api.airtable.com/v0/<api>/<endpoint>?api_key=<apikey>")) else Json.Document(Web.Contents("https://api.airtable.com/v0/<api>/<endpoint>?api_key=<apikey>&offset="&Last_Key&"")), // retrieve results per call
    		       Counter = [Counter]+1// internal counter
                      ],
   		each [WebCall]
    ),1)
in
    Pagination

I got help in finding the solution here.

Thank you! This helped me so much!

Hello Mo_re

You seem to have closest to solving the pagination problem with Airtable’s API and using it successfully in Power BI.

This is exactly what I’m trying to do, albeit unsuccessfully.

I have used your code, and changed it to reflect the table and API details. It is successfully pulling the first 100 records, but then there is a second block which throws up an error:

Web.Contents failed to get contents from ‘https://api.airtable.com/v0/app9KuDCprvz0KkC4/Orders?api_key=keyfCT5EWGzVJDv9n&offset=itrb129iLnjMud...’ (422): Unprocessable Entity

I’d really like to use your help on this. Don’t know if personal info is permitted here, but could you send me a PM, so that I could use your help?

Thanks!

Jani_Green
4 - Data Explorer
4 - Data Explorer

Hi, did anyone find a solution to the unprocessable error please? I can test the string without offset straight in a browser window and get the desired (unformatted) response but when i add the offset i get "{“error”: “type”:“LIST_RECORDS_ITERATOR_NOT_AVAILABLE”}}

Thanks!