Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Mar 23, 2023 12:10:46 AM
Feb 27, 2023 4:04:53 AM
This article is meant to get users starting on the API key connector in Qlik Application Automation.
This connector is designed for advanced users to connect to platforms that do not have a dedicated connector
The connector employs the API key authentication flow, which requires only the API key to make requests to a specific API.
Index:
{
"content": [{
"endDate": "2021-11-01T05:55:00.000+0000",
"status": "unpublished",
"created": "2021-06-16T18:40:12.000+0000",
"websiteUrl": "https://events.bizzabo.com/337104",
"modified": "2021-08-30T20:54:52.000+0000",
"timezone": "America/Denver",
"name": "Pluralsight LIVE 2021"
}]
}
Not Supported results type :
[{
"endDate": "2021-04-08T19:00:00.000+0000",
"status": "published",
"websiteUrl": "https://events.bizzabo.com/309250",
"modified": "2021-04-01T16:38:46.000+0000",
"timezone": "America/Denver",
"name": "Pluralsight Summit",
"id": 309250
}]
Begin by looking for the "API Key Connector" connector. When you click connect, the following input parameters are requested:
GET / HTTP/1.1
Host: example.com
Authorization: Basic <api_key>
curl -X GET "https://example.com/endpoint/?api_key=<api_key>"
When selecting the connector in automation you will notice that there are only a few blocks available, depending on the type of request and pagination involved in your request. These blocks have the following input variables:
The following example will obtain list of events from the Tripletex application. We do not yet have a connector to do this and API key is used to obtain the value for the Authorization header/ Query string. We first start by obtaining the Base URL and API Key. From the Tripletex documentation we can find these at https://api.tripletex.io/v2-docs/#/ . We use the following values:
Once you fill the above details in the connector connection pop-up and click save, it would say the connector is connected. But since this is a generic connector, we don't have a way of verifying if the connector is actually connected. This will be evident when you run an endpoint.
Create a new automation and drag the Raw API List Request Offset Based Paging block from the API Key connector on to the canvas. Since the Tripletex connector supports offset based paging, we will be using the Offset Based Paging block to execute the list events api.
Raw API List Request Offset Based Paging block inputs are as follows:
The information in this article is provided as-is and is to be used at your own discretion. Depending on the tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.
Great article.
I'm able to get a response using the API Key Connector - Raw API Request block - the API we're using has a default of 30 results per page and this block shows the 30 results.
I've tried to setup using the API Key Connector - Raw API List Request Page Number Based Paging but having little success. If i were to pass page size and page into the URL it would be field names,it would be &pageSize=20&page=2 and via postman this works fine .
I've tried passing pageSize and page into the block but i get no results.
Heres how it looks on postman.
For the REST Connector for pagination within an apps data sources i use the header fields Result-Pages, Result-Total for pagination, ive tried those but again no results.
Any ideas where i'm going wrong?
Thanks
John
if hell
if helps, the response looks likes this, it comes back in an array, so i use the . for json output - don't know if thats right or not?
HI @jmcy2408 ,
If the business data in the API response is not contained in a JSON key, the list blocks will not function.
Only responses like the ones below make it work.
{
"data":[
{
"id":12,
"cost-center": "",
"name": "example"
},
{...}
],
"page":1,
"pageSize":20
}
AND period should be used in the "json_path_for_output_records" input parameter to point to the nested array. As in data.companies.quotes if the API response looks like this
{
"data": {
"companies": {
"quotes":
[
{
"id":12,
"cost-center": "",
"name": "example"
},
{...}
]
}
},
"page":1,
"pageSize":20
}
HI @Jayarams
Thanks for coming back to me.
Doesn't look like the API Key block will work for us at this time then as the page and pageSize is not contained within the response.
I'll revert to using Call URL, getting the header info containing pages and looping through.
Thanks
John
HI @jmcy2408
It's not about the page or the size of the response. It is instead about how the business data is stored within the Json key, as previously explained. It's also mentioned in the article's Limitation section.
Unfortunately, the API you are using does not support it.😞