Skip to main content

Hello,

To implement pagination in the API endpoint "https://domainname/api/v2/search/tickets?updated_since=2023-01-01T02:00:00Z&page{}", you need to provide the page parameter in a nested format. I prepared a custom RSD file specific to this API after reading the "Nested parameter" article. I have created a loop starting from 1 in the given code.  However, I'm not able to see any data. I'm not receiving any errors during the transfer and synchronization processes. You can find the RSD file attached.
I would appreciate in resolving this issue.
Best Regards

Hi Erdem

I looked at it and I can’t say specifically what is the issue, but it may be one or more of the things.

I always start by looking at the log file to see what calls it does.

What I wonder about is why you close all your call tags in one row like this.

<api:call op="httprequest" method="GET" url="=initialPageUrl]" response="initialPageResponse" />  
<api:set attr="totalPages" value="=initialPageResponse.total_pages]" />

I have not suggested this method in any of my guides, so I can’t tell you how that will work. The same goes for the loop method. I have a guide where you can use the Enum method to do loops, so that is what I have in my guides.

You are doing pagination, couldn’t one of my suggested option make this work, like this?

All you need to know is what to add in the three following rows.

<api:set attr="pagenumberparam" value="page" /> 
<api:set attr="pagesizeparam" value="pagesize" />
<api:set attr="pagesize" value="100" />

Also to do pagination you need to apply it like so.

<api:set attr="EnablePaging" value="true"/>

It is the first step to apply pagination.


Hello @Thomas Lind 

I wanted to do this and ask because I'm curious if I can create a for loop not only for this project but also for other projects. Some API URLs contain IDs. Let's take weather station IDs as an example. They range from 1000 to 1005 or include mixed numbers like 3000, 3003, 5007. These data cannot be directly written into the URL address. What should I do in this case?


Hi Erdem

That is possible if you have the range in a list.

Either by doing a nested call that gives all the available ids, or by using an Enum method.

If you can’t find it as a list of values like explained above, you may be able to use the Continue option to make it go past 3001 in a list consisting of 3000,3002 and so forth.


Reply