
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nprinting API: Send On-demand request with Postman
Feb 18, 2022 9:48:50 AM
Aug 6, 2017 5:00:45 AM
This article explains how to send a request to Nprinting On-Demand API using Postman.
The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.
Prerequisites:
- Before proceeding below, check the following article: NPrinting API Setup Requirements
- Qlik Nprinting Server 17.4 (June 2017) or higher (Qlik Nprinting Engine also needs to be installed. It is not required to install the On-demand QlikView extension)
- "Enable On-Demand and API report generation" should be enabled on the report.
- QlikView Desktop Personal Edition is not supported.
Resolution:
First of all, install the Postman Chrome extension. See QRS API using Xrfkey header in Postman for some basic knowledge about how to getting started with Postman.
Authentication
COMMAND | URL |
GET | https://yourservername:4993/api/v1/login/ntlm |
Request headers:
Content-Type | application/json |
If it returns code:0 (Status: 200 OK) then it means that the authentication went well.
If it returns code:1 (Status: 401 Unauthorized), then it may be that the Windows user used does not have sufficient rights.
Go to the Nprinting Web Console and make sure that the user exists and is enabled:
Fetch the report ID to run
We now need to fetch the report ID for the report we want to run.
COMMAND | URL |
GET | https://yourservername:4993/api/v1/reports |
Response:
The report ID in this case is ce4cd669-4040-4b9c-9f20-94541c907f9e.
Send on-demand request
COMMAND | URL |
POST | https://yourservername:4993/api/v1/ondemand/requests |
Request headers:
Content-Type | application/json |
Request Body:
{ "type": "report", "config": { "reportId": "ce4cd669-4040-4b9c-9f20-94541c907f9e", "outputFormat": "HTML" } } |
The following response should be returned:
The request ID is b81a2160-d871-4c09-952c-bd8d28563986 in this case. We can use this ID to check the request status and fetch the request when it is completed.
Note: if the POST request returns the error "403 Forbidden REVEL_CSRF: tokens mismatch" check this link and add the X-XSRF-TOKENwith the value of the cookie in the header
Fetch On-demand request status
COMMAND | URL |
GET | https://yourservername:4993/api/v1/ondemand/requests/b81a2160-d871-4c09-952c-bd8d28563986 |
Response:
{
"data": {
"id": "b81a2160-d871-4c09-952c-bd8d28563986",
"status": "completed",
"created": "2017-08-06T08:50:26Z",
"requestType": "Report",
"reportType": "Html",
"outputFormat": "HTML",
"title": "Report1"
}
}
Download Report
You will need to open this URL in a browser tab in order to download the report as Postman will just show the file as binary.
URL:
https://yourservername:4993/api/v1/ondemand/requests/b81a2160-d871-4c09-952c-bd8d28563986/result
A popup will appear and asks if you want to download the file.
Note: If you are not authenticated in the browser you are trying to request this URL from. You will need to log in again using https://yourservername:4993/api/v1/login/ntlm