cancel
Showing results for 
Search instead for 
Did you mean: 
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
Highlighted
Community Support
Community Support

Re: Rest api with offset & limit loop script

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.
Community Support
Community Support

Re: Rest api with offset & limit loop script

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.

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors