Skip to main content
SUBMITTED

REST API: Allow change of post body and url for pagination

Related products:TimeXtender Data Integration
  • October 7, 2024
  • 4 replies
  • 41 views

Forum|alt.badge.img+1

Some APIs require a change in both url and post body when doing pagination.
It would be great if this was possible to do with the TimeXtender REST connector.

For example The Danish Business Authority (CVR register) requires the initial call to be made to one URL with a specific post body and all subsequent calls done to another URL with a postbody only containing the pagination token

4 replies

Thomas Lind
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • October 7, 2024

Hi @nmo 

Is this pagination token unique to each endpoint POST call you do?

You use one URL to do the initial call and then another to do the following

In that it needs to be set up specifically for each endpoint and not as a general rule.


Forum|alt.badge.img+1
  • Author
  • Contributor
  • October 7, 2024

The initial call for each endpoint is done to specific url, f.x.:
Endpoint 1: http://distribution.virk.dk:80/cvr-permanent/produktionsenhed/_search?scroll=10m
Endpoint 2: http://distribution.virk.dk:80/cvr-permanent/virksomhed/_search?scroll=10m

The pagination is then done to the same url for both endpoints with a new post body containing the token:
http://distribution.virk.dk:80/_search/scroll


Thomas Lind
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • October 7, 2024

Hi @nmo 

I have some questions.

What do you get from the call to the first endpoint? If that is a pagination token, there is only one page? 

Maybe you could try to use dynamic values here?

One endpoint where you make the initial request, and one endpoint (using dynamic values from endpoint table) that use the value(s) it needs from it in its post body. 

I was thinking that it may be sort of possible to do already and if not how close we are.


Forum|alt.badge.img+1
  • Author
  • Contributor
  • October 8, 2024

I think I tried something similar to what you are suggesting, but I couldn’t wrap my head around how I would make it work.

Initial query returns a scroll_id as well as the first set of data.
All subsequent call are then made to another url with another post body as well.
All the subsequent calls are made using the same scroll_id that is returned from call #1.

The calls with the scroll_id are of an unknown amount - could be hundreds or thousands depending on filters