cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
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
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors