Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlikview Rest connector with Zendesk (pagination issue)

Hi Everyone,

I am testing the REST connector in Qlikview, i can connect and fetch the first 1000 tickets without problems.

My issue is that I haven't managed to setup the pagination, to fetch more tickets.

Can someone tell me what the pagination type should be, and the parameters to enter?

Thanks in advance,

Christian

8 Replies
pascal_theurot
Partner - Creator II
Partner - Creator II

Hello Christian

Using this URL, i can manage an unllimited number of tickets records without pagination (you can change start_time of course) :

yourcompany.zendesk.com/api/v2/incremental/tickets.json?start_time%21332034771

Pascal
pascal_theurot
Partner - Creator II
Partner - Creator II

Christian,

Before incremental, I've tried without success the "next url" pagination on Zendesk :

nextpage.jpg

'next_page' is sent by zendesk int the url body. it seems not to be read by the connector.

Pascal
pablolabbe
Luminary Alumni
Luminary Alumni

Hi Christian,

Have you checked this ?  Introduction - Core API - Zendesk Developer Portal

Not applicable
Author

Hi, thanks for your replies.

@Pablo: Yes i checked the zendesk core API documentations, and it says the next page is stored in the next_page field at the end of the set.

I tried what Pascal did (pagination type and url) but unfortunately it still wouldn't go through all pages.

@Pascal: The url you provided will only fetch 1000 tickets, unless i am missing something.

As a workaround, I wrote this little script and it works well enough (some duplicates need to be taken care of afterwards):

//SCRIPT

let v_Start_time = 1450332763;

let v_CountTickets = 1000;

Do while v_CountTickets/1000=ceil(v_CountTickets/1000)

CUSTOM CONNECT TO "Provider=QvRestConnector.exe;url=https://MYCOMPANY.zendesk.com/api/v2/incremental/tickets.json?start_time%2$(v_Start_time)&include%2m...";

RestConnectorMasterTable:

//Removed the script generated automatically by the connector

[from]:

//Removed the script generated automatically by the connector


[to]:

//Removed the script generated automatically by the connector

[source]:

//Removed the script generated automatically by the connector

[via]:

//Removed the script generated automatically by the connector

[collaborator_ids]:

//Removed the script generated automatically by the connector

[tags]:

//Removed the script generated automatically by the connector

[custom_fields]:

//Removed the script generated automatically by the connector

[satisfaction_rating]:

//Removed the script generated automatically by the connector

[sharing_agreement_ids]:

//Removed the script generated automatically by the connector

[fields]:

//Removed the script generated automatically by the connector

[followup_ids]:

//Removed the script generated automatically by the connector

[reply_time_in_minutes]:

//Removed the script generated automatically by the connector

[first_resolution_time_in_minutes]:

//Removed the script generated automatically by the connector

[full_resolution_time_in_minutes]:

//Removed the script generated automatically by the connector

[agent_wait_time_in_minutes]:

//Removed the script generated automatically by the connector

[requester_wait_time_in_minutes]:

//Removed the script generated automatically by the connector

[on_hold_time_in_minutes]:

//Removed the script generated automatically by the connector

[metric_set]:

//Removed the script generated automatically by the connector

[tickets]:

//Removed the script generated automatically by the connector

//Getting the max timestamp for next call

Temp:

Load Max(generated_timestamp) as MaxTimestamp Resident tickets;

v_Start_time=FieldValue('MaxTimestamp',1);

Drop Table Temp;

//Get number of tickets and to check in the while condition if it is a multiple of 1000

Temp2:

Load count(__KEY_tickets) as CountTickets Resident tickets;

v_CountTickets=FieldValue('CountTickets',1);

Drop Table Temp2;

LOOP;

DROP TABLE RestConnectorMasterTable;

pascal_theurot
Partner - Creator II
Partner - Creator II

Hello Christian,

I retrieve more than 5000 tickets using the URL above ?

Anyway, your workaround is nice even if it takes probably more time.

Pascal
Not applicable
Author

In the end I decided to use a Python script, which is working fine.

Can pm me for script example.

Christian

Anonymous
Not applicable
Author

Are you using any query parameters in the API call?

I believe there is a bug when using the Next URL pagination setting, when that is enabled Qlik isn't sending the Query parameters as part of the request.

Verified this using Fiddler trace (run Fiddler logged on as the service account Qlik is running under and enable HTTPS decryption if REST call uses HTTPS).

While it is possible to put the GET query parameters in the URL directly, in my case it doesn't help as the query parameters include an API key, which is NOT included in the next URL field - meaning if I do it this way the first query runs OK but the next request goes to the next page URL and doesn't include the API key.

Alternatively - looking at the screenshot above you may just need to change next_page to root/next_page. Check what the JSON being returned looks like, if you have opening brackets to start with like the example below your first part of the path should be root.

{

     links {

          next: "https://host/data?page=2"

     }

}

Next page field = root/links/next

davidganly
Partner - Contributor III
Partner - Contributor III

Hi all,

I'm working with a very small set of data so i am not sure of the response when you get to the thousands but

entering into the url - https://[yourcomapny].zendesk.com/api/v2/incremental/tickets.json?start_time=0

then selecting the pagination - next_url and entering the value next_page

I am testing with qlik sense desktop 2.2.3 - not sure if that has an impact but it returned over 2 hundred tickets for me.

hope this helps