Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
DavidFoster1
Specialist
Specialist

NPrinting API - Creating a POST connection in QlikSense

rpc

I am struggling to create a POST connector to the NPrinting API in QlikSense. I have a working GET connector, but when I try to create a POST connector I get a 403 error.

============Extract From PDF ============================

From the

LIB CONNECT TO 'NPrinting REST Login (POST) (qtsel_gpr)';

RestNPReloadMetadataTable:

SQL SELECT

"__KEY_data"

FROM JSON (wrap off) "data" PK "__KEY_data"

WITH CONNECTION( URL "$(vReloadMetadataURL)", HTTPHEADER "cookie" "$(vCookie)");

[metadata_items]:

LOAD [__KEY_data] AS [__KEY_data]

RESIDENT RestNPReloadMetadataTable

WHERE NOT IsNull([__KEY_data]);

DROP TABLE RestNPReloadMetadataTable;

Notice how we needed to switch to the second Qlik Sense REST Connector that we configured at the beginning (see the “LIB CONNECT” instruction). This second connector uses the POST method which is needed to fire a metadata reload.

Once a “POST” connection is established we switched to the right API endpoint using the usual “WITH CONNECTION” trick. Notice how we used the dynamic URL contained in the “vReloadMetadataURL” variable that we created in the previous step.

If you take a look at the NPrinting Task Execution

======================================================

NPrinting_APi_Data_load_editor_Qlik_Sense.png

NPrinting APi _ Data load editor - Qlik Sense Error.png

What am I missing?

1 Solution

Accepted Solutions
Ruggero_Piccoli
Support
Support

Hi,

Did you already checked this post Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script?

Best Regards,

Ruggero

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT https://community.qlik.com/docs/DOC-14806. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.

View solution in original post

6 Replies
Ruggero_Piccoli
Support
Support

Hi,

Did you already checked this post Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script?

Best Regards,

Ruggero

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT https://community.qlik.com/docs/DOC-14806. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
DavidFoster1
Specialist
Specialist
Author

That is what the PDF extract is from. GET is working nicely (to a point), but POST is a problem

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi David,

From the link Ruggero mentioned - you need to go through steps to get a session cookie.... Basically try to follow steps as in this document.

Then you need to include this cookie in your POST body... else it will not work..

cheers

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
DavidFoster1
Specialist
Specialist
Author

So a POST lib connect must follow a GET lib connect so that it has a cookie?

The document says it is a different connection. If it required the same cookie would it not be better to use a method override?

rpc‌ can you advise on this?

DavidFoster1
Specialist
Specialist
Author

Apologies guys. If I read the instructions properly it would have worked 🙂

I missed both the origin header and the NPrinting trusted origin configuration.

Connection successful now.

Ruggero_Piccoli
Support
Support

Thanks for the feedback 🙂

Best

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.