Qlik Community

Qlik Sense Data Connectivity

Discussion board where members can learn more about Qlik Sense Data Connectivity.

mlehtola
New Contributor

Overwrite POST body with Qlik REST Connector

I'm trying to overwrite the POST request body with Qlik Rest Connector. As in documentation the syntax is WITH CONNECTION(body "<Overwrite>") . This works great as long the body does not contain double quotes (").

My use case sending email with sendgrid API and post body is like this:

{"personalizations": [{

     "to": [{"email": "some@example.com"}]}],

     "from": {"email": "some@example.com"},

     "subject": "Sending with SendGrid is Fun","

     content": [{"type": "text/plain", "value": "and easy to do anywhere"}

]}

This works great when creating the connection with Create connection wizard, but when I try to manipulate the body in script with WITH CONNECTION (body "{newBody}") that contains double quotes the script fails.

Is there a way to escape double quotes in the WITH CONNECTION (body "")?

Tags (1)
3 Replies
sandeep_roy
Contributor

Re: Overwrite POST body with Qlik REST Connector

Hi Markus,

I have also tried the way you are trying, sometimes API functions differently or double quotes need to checked properly.


Try to put it another way,

WITH CONNECTION ( URL "",

                                      QUERY "to" "$(vTo)",

                                       QUERY "from" "$(vfrom)"

                                            next query like this);

mlehtola
New Contributor

Re: Overwrite POST body with Qlik REST Connector

Hi Sandeep,

tried dollar sign expansion and also replacing " with chr(34) with no success. Api does not work without double quotes so that does not hel.

sandeep_roy
Contributor

Re: Overwrite POST body with Qlik REST Connector

Hi Markus,

I would suggest then to attach the connection part in your script here and error screenshot also so that to understand the error better.

Community Browser