Pagination of RESTful API Response

Pagination of RESTful API Response

  
How do I paginate a Record Table with data coming from a RESTful API?

It is not an entity and cannot be dragged into the main screen flow. The RefreshData widget cannot find compatible data source.

Stanley
Hello Stanley,

As for the scafolding that is done by dragging an entity to screen, keep in mind that all the magic that happens on the created screen can be achieved by hand. All the components used are either widgets like table records, or stuff from Rich Widgets. Spend some time analysing them and you'll see that there's a lot to learn there :)

About pagination of the data that is coming form your RESTful API. I would try to first understand if that API supports pagination by itself. If it does, you could try to take advantage of that and try to compose a screen that uses RichWidgets blocks and work from there. I can help if you need. If the API itself does not support pagination, I guess that you'll need to go with a local database cache where you save the results. 

Cheers
Pedro Cardoso
The RESTful API does not support pagination. Do you have an example of one which supports pagination?

Thanks,
Stanley
Hey, that's not good :(

Check this good example: https://developer.zendesk.com/rest_api/docs/core/introduction#pagination
Thanks.
Good stuff.
You could still paginate if you did a bit of work. There are methods to pull the requested page number, and number of records per page, if you look at the scaffolding-created actions you will see how it works. You could use that to pass to the REST API. You *may* need to inject fake records into the results list before the current page to pad it out, if memory serves.

J.Ja
Solution
Justin James wrote:
You could still paginate if you did a bit of work. There are methods to pull the requested page number, and number of records per page, if you look at the scaffolding-created actions you will see how it works. You could use that to pass to the REST API. You *may* need to inject fake records into the results list before the current page to pad it out, if memory serves.

J.Ja
Indeed. Still, it really depends on the amount of records, and how fresh your data needs to be.
-       Few data expected and fresh data is required: go with J.Ja. solution;
-       Large amounts of data and fresh data is not required: go with a local database cache;
-       Large amounts of data and fresh data is required: the 3rd party needs to implement pagination, unless it’s impossible. BTW: you’re getting unreasonable requirements. Run away!)
 
Solution
Thanks for the discussion. I got more than I asked.

The API is internal developed but quite old. If changing it is not possible I will try to get the raw data from database via an extension.