Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jerremans
Regular Visitor

Rest api with offset & limit loop script

Hi All,

 

I have searched a lot on the internet and tried a lot, but I cannot find how to solve this now.

So i hope one of you can help me with the following problem.

 

I want to get the data from the following REST API https://developer.simplicate.com/explore
but when I get the data I only get 100 rows.

 

I have seen that you can use the limit and offset function here and that you can still use count and total count in the metadata.
I can't get more rows through the loop than the 100.

Who could help me with a script where he can download all rows for, for example: get /crm/organization

 

 

Thanks in advance for your knowledge and help,

Jerremans

2 REPLIES 2
v-lid-msft
Community Support
Community Support

Hi @Jerremans ,


How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Jerremans ,

 

Here is a very similar thread you can refer to: https://community.powerbi.com/t5/Desktop/Trouble-with-Pagnation-for-Airtable/m-p/813722#M391214

 

let Simplicate = 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("http://developer.simplicate.com/api/v2/crm/organization")) else Json.Document(Web.Contents("http://developer.simplicate.com/api/v2/crm/organization?offset="&Last_Key)), // retrieve results per call
    		       Counter = [Counter]+1// internal counter
                      ],
   		each [WebCall]
    ),1)

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.