<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Qlik Nprinting API - Request is malformed? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/67352#M608791</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Geir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not tested your code but you may get some ideas from this article &amp;amp; example: &lt;A href="https://community.qlik.com/docs/DOC-19045"&gt;NPrinting API script Example - Python&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH - Daniel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Feb 2018 22:01:32 GMT</pubDate>
    <dc:creator>Daniel_Jenkins</dc:creator>
    <dc:date>2018-02-21T22:01:32Z</dc:date>
    <item>
      <title>Qlik Nprinting API - Request is malformed?</title>
      <link>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/67351#M608790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit; text-align: justify;"&gt;Hi, I am trying to connect to the Qlik Nprinting API with this Python code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;###########################################&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;import requests&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;import sys&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;import requests&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;import json&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;import os&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;from requests_ntlm import HttpNtlmAuth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;def toJson(obj):&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return json.dumps(obj, default=obj_dict)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;def obj_dict(obj):&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return obj.__dict__&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;url = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://server:4993/api/v1/login/ntlm" rel="nofollow" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #3778c7;" target="_blank"&gt;https://server:4993/api/v1/login/ntlm&lt;/A&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;headers = {'Content-Type': "application/json", }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;auth = HttpNtlmAuth("corp\myusername", "password")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;response = requests.request("GET", url, headers=headers, auth=auth)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Cookies = requests.utils.dict_from_cookiejar(response.cookies)&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Token = Cookies['NPWEBCONSOLE_XSRF-TOKEN']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;print(response.text)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;url = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://server:4993/api/v1/filters" rel="nofollow" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #3778c7;" target="_blank"&gt;https://server:4993/api/v1/filters&lt;/A&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;headers = {&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'X-XSRF-TOKEN': Token,&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Content-Type': "application/json;charset=utf-8",&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;# response = requests.request("GET", url, headers=headers, cookies=response.cookies)&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;# print(response.text)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;payload = {"enabled": "true", "name": "SlettMeg", "description": "Beskrivelse OK", "appId": "64baf597-e4c5-4246-aa44-a12ac73f367e", "fields": "", "id": "", "created": "", "lastUpdate": ""}&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;payloadJson = toJson(payload)&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;response = requests.request("POST", url, headers=headers, cookies=response.cookies, json=payloadJson, verify=True)&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;print(response.text)&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;###########################################&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;But I keep getting:&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;{"result":"5ca8d737-54e6-4286-99a0-8025de0a2753","code":0,"message":null}&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;{"error":{"code":400,"message":"Request is malformed."}}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;What do I need to do to make this work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Kind regards, Geir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 21:43:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/67351#M608790</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-21T21:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Nprinting API - Request is malformed?</title>
      <link>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/67352#M608791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Geir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not tested your code but you may get some ideas from this article &amp;amp; example: &lt;A href="https://community.qlik.com/docs/DOC-19045"&gt;NPrinting API script Example - Python&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH - Daniel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 22:01:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/67352#M608791</guid>
      <dc:creator>Daniel_Jenkins</dc:creator>
      <dc:date>2018-02-21T22:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Nprinting API - Request is malformed?</title>
      <link>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/67353#M608792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, but my script is already based on this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can login and do GET requests on&amp;nbsp; i.e =&amp;gt; /api/v1/apps or &lt;SPAN style="font-size: 13.3333px;"&gt;/api/v1/filters&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;but I am unable to POST a Filter for some unknown reason. I have tried to manipulate the request and payload many times now, but I keep getting the &lt;STRONG style="font-style: inherit; font-size: 13px; font-family: inherit; color: #3d3d3d;"&gt;{"error":{"code":400,"message":"Request is malformed."}.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13px; font-family: inherit; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If you run this script with your own server and credentials, you can see if you get the same error?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- &lt;SPAN style="font-size: 13.3333px;"&gt;Geir&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 22:51:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/67353#M608792</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-21T22:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Nprinting API - Request is malformed?</title>
      <link>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/1591194#M608793</link>
      <description>&lt;P&gt;Geir did you ever have luck with this? Could you create a filter?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:11:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Qlik-Nprinting-API-Request-is-malformed/m-p/1591194#M608793</guid>
      <dc:creator>jonvitale</dc:creator>
      <dc:date>2019-06-12T17:11:57Z</dc:date>
    </item>
  </channel>
</rss>

