Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
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: 
aaron_ppmc
Partner - Contributor III
Partner - Contributor III

Nprtinting Create User with domainAccount via Rest API

Hello Community,

have you an idea to pass trouth the domain string like "domain\userid".

i try to insert users into Nprinting Feb. 2018 but when i fill in domain\userid, it will fail with

QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 400 (Bad Request):

{"error":{"code":400,"message":"Request is malformed."}}

RestNPPOSTandPUTTestTable:

SQL SELECT

"__KEY_data"

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

WITH CONNECTION( URL "*********/api/v1/users", BODY "{""Username"":"""",""Email"":"""",""Password"":""123"",""Enabled"":""true"",""Folder"":"""",""Subfolder"":"""",""DomainAccount"":""DOMAIN\USER"",""Timezone"":""Europe/Vienna"",""Locale"":""de""}",

HTTPHEADER "Origin" "https://***********",

HTTPHEADER "Content-Type" "application/json",

HTTPHEADER "cookie" "NPWEBCONSOLE_SESSION=967f0a56b127b200ec358a32ca1eb084f4dbe1fa-%00NPWEBCONSOLE_XSRF-TOKEN%3AopT1Hrhu3Rr6xKl4Z6tuqVHNiRm6WGXKGX10V2wx7%2Bw%3D%00%00_TS%3Asession%00%00userid%3A6a4a3525653a4739b67667b86bcd2bd8%00; ")

thank you for your Response

1 Solution

Accepted Solutions
Ruggero_Piccoli
Support
Support

Hi,

Remember to add the escape character. So the domain account should be similar to Domain\\Account.

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 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

7 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Aaron,

  1. The first and most important thing is that you need to provide all required information (email, name, timezone etc) I am not sure which fields are compulsory but you can check it out in NPrinting admin console when creating a new user (you will not be able to save record untill you fill up all required fields)
  2. I have created a QlikView script which reads a user details then loops through each user record and creates or uptades it.
  3. Domain user is just a string in format: domain\user
  4. I use API (with 2 connections POST and GET - therefore you will see 2 Subrutines) to update create records.  Please not also that with API call you can populate users Folder and Subfolder entries which is briliant

see code in attached file - navigate to section with USERS:

cheers

Lech

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

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 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.

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.
Ruggero_Piccoli
Support
Support

Hi,

Remember to add the escape character. So the domain account should be similar to Domain\\Account.

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 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.
Ruggero_Piccoli
Support
Support

For example:

{

"email":"name@domain.com",

"enabled":true,

"userName":"NewUser",

"domainAccount":"domain\\user",

"timezone":"CET",

"locale":"En",

"folder":"c:\\NewUser",

"subFolder":"NewUser",

"password":"Password123"

}

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 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.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

‌this is incosistent then as it works for me with single \ character like: Domain\user

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.
Ruggero_Piccoli
Support
Support

Hi Lech,

The \ as escape characters could be added automatically by the client you are using to send the API request or by a library you used in your program. For example I tested the snippet I just posted in ARC. If I use the JSON visual editor I simply need to specify a single backslash:

Create a User JSON editor.png

but if you open it in the raw editor you see the double backslashes

Create a User RAW editor.png

The same could happens if you are using a library that format the JSON code in a custom software. The library adds the needed backslashes.

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 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.
aaron_ppmc
Partner - Contributor III
Partner - Contributor III
Author

thank you for all your help, I tested domain\\user and it worked for me

best regards

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Cool understand,

I was using Qlik Rest Connector and i was executing content from my script as a part of chaining reload - import/update users - distribute report.

regards

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.