Hi Team, We are using API Extract component to make REST API calls, We need to make API calls in paginated manner. Need help below are details

We are using Cursor-based Pagination documented at https://documentation.matillion.com/docs/6753241#cursorbased-pagination

 

The API call is working in paginated manner but API Extract component is not able to load response in table because combined response is not a valid JSON.

 

Sample API:

https://any.us-east-1.amazonaws.com/api/locations?single_page=true

 

 

The API response looks like

{

"locations": [{"some_key_page_1": "some value page 1"}],

"continuation_key": "7c9553bb-7d16-43a0-9426-caf0d88483c3"

}

 

In next page call we need to pass continuation_key in URL so URL would be https://any.us-east-1.amazonaws.com/api/locations?single_page=true&continuation_key=7c9553bb-7d16-43a0-9426-caf0d88483c3

 

The API response looks like after 2nd paginated call

{

"locations": [{"some_key_page_2": "some value page 2"}]

}

 

Since continuation_key is not present on second page means it is last page and no further calls so combined response from 1st & 2nd call is as below

 

{

"locations": [{"some_key_page_1": "some value page 1"}],

"continuation_key": "7c9553bb-7d16-43a0-9426-caf0d88483c3"

}

{

"locations": [{"some_key_page_2": "some value page 2"}]

}

 

Any idea how to fix this?

Hi @User16412956852748952867​,

I have to admit, I have not had to utilize the cursor paging method yet. I don't see anything in the documentation that tells me how Matillion is assembling the results of the pages to create the document. I personally like to use the API Profiles and API Query component as much as possible because it's been around a lot longer and has had a lot more development time than the API Extract side. The API Query component also has a feature that allows you to turn on debugging that will give you a lot more information of what Matillion is doing. This debugging option doesn't currently exist in the API Extract component.

You might try implementing the same REST API calls in the API Profile set of components which also supports cursor based paging. You may want to also check the Server Logs. There is sometimes useful information going on there.

If all those options don't lead you to ideas or solutions, I would say it's time to reach out to support and see if they can help.

Hopefully something I provided, will help. Good luck!

@Bryan​ Thank you for the response, got it working using API Query component.

Glad to hear! The API Query route is the most robust and it's capabilities blow the API Extract functionality out of the water in my opinion.