You can translate the question and the replies:

Problem with pagination for JSON HTTP datasource

I have a JSON HTTP datasource that returns data that looks like this: ``` { "pagination": { "pageNumber": "3", "pageSize": "100", "totalAvailable": "251" }, "datasources": { "datasource": [ {"name": "some datasource", "id": 1}, {"name": "another datasource", "id": 2} ] } } ``` I created a JSON base view with the tuple root set as /JSONFile/datasources/datasource and this successfully returns one row for each item in the datasource array. But when I try and set up pagination (using pageSize/pageNumber URL parameters) the view fails as Denodo doesn't stop the page requests after there are no more records to return. The documentation claims that Denodo should stop making requests as soon as a request returns fewer rows than the previous one, but this doesn't appear to be happening. Furthermore if the number of rows is divisible by the page size this method would fail. It seems we should be able to make a setting to get the datasource to stop making requests when a certain HTTP code is returned, in this case it would be 400.
user
25-10-2022 09:19:40 -0400
code

1 Answer

Hello, I understand that you have a JSON data source in Denodo, for which you want to implement pagination based on page size and total rows. I implemented the same on my test JSON data source and enforced the required pagination method by going to **Data Source > Configuration > Connection > Configure> Pagination** in Virtual DataPort Administration Tool/ Design Studio and checking the option *The service returns the data paginated* . Here I got the option to set the limit for **Max number of requests**, which limits the number of requests made to the database. After this, I chose the *Paging With Indices* option and configured it. Thereafter, I created the base view from this data source and it is fetching the data as expected. You can refer to the document [JSON sources](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_data_sources_and_base_views/json_sources/json_sources) to get all the detailed information about the steps I followed to set up my data source. And for information on configuring the required pagination method and how it works, you can refer to the document [Pagination](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_data_sources_and_base_views/path_types_in_virtual_dataport/http_path#vdp-admin-guide-path-types-pagination) . Hope this helps!
Denodo Team
27-10-2022 15:32:23 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here