Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anjana
Contributor
Contributor

maxResults in Rest Api connection

My REST API query only returns 1,000 results although it is configured to return maxResults=5000, and the total number of stories in my project is around 3000. Is there any way to increase the maxResult value?

1 Reply
TimvB
Creator II
Creator II

It is very common that an API request returns a maximum of 1000 results. To get around this you need to do multiple API requests by using pagination.

Qlik Pagination: https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Create...

 

I often use the statement 'with connection' in a loop to configure the offset and count request parameters of the API. Of course, this depents on the request parameters of your API.

 

//=== Initialize

Let voffset = 0;

Let vcount= 1000; //Max results per API request

 

For i = 1 To 3

RestConnectorMasterTable:

SQL SELECT

"__KEY_root",

(SELECT

"__FK_items",

"__KEY_items",

(SELECT

"email",

"displayName",

"self",

"__FK_creator"

FROM "creator" FK "__FK_creator")

FROM "items" PK "__KEY_items" FK "__FK_items")

FROM JSON (wrap on) "root" PK "__KEY_root"

WITH CONNECTION(Url "https://content.googleapis.com/calendar/v3/calendars/primary/events?key=YourKey&offset=$(voffset)&count=$(vcount);

 

RestTableName:

[Your Fields]

Resident RestConnectorMasterTable;

Drop table RestConnectorMasterTable;

 

If i = 1  Then
//=== Create the table FinalTableName
Rename table RestTableName to FinalTableName;
Else
//=== Add new results to the table FinalTableName
Concatenate(FinalTableName) Load * Resident RestTableName ;
Drop table RestTableName ;
Endif;


//=== Update pagination offset counter
Let voffset = '$(voffset )' + 1000;

Next i; //Next Pagination