Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tayariib85
Contributor II
Contributor II

Connect REST Post with request body

Hi guys, 

I am trying to make Connection REST Post with request body, and here is what I am doing:

First, I created a variable with the body 

LET vRequestBody = '{ "where": {}, "index": 0, "count": 1000 }';

Second I used used the variable in WITH CONNECTION ()

tayariib85_0-1676627803540.png

Then I get this error

tayariib85_1-1676627906283.png

tayariib85_2-1676627990208.png

Any advice !

 

Thank you in advance

Labels (1)
1 Solution

Accepted Solutions
tayariib85
Contributor II
Contributor II
Author

I resolved it by adding  double quotes to the variable: 

LET vRequestBody = replace(vRequestBody,'"',chr(34)&chr(34))

Reference to this post:

https://community.qlik.com/t5/Integration-Extension-APIs/WITH-CONNECTION-statement-BODY-with-Double-...

 

View solution in original post

3 Replies
tayariib85
Contributor II
Contributor II
Author

I resolved it by adding  double quotes to the variable: 

LET vRequestBody = replace(vRequestBody,'"',chr(34)&chr(34))

Reference to this post:

https://community.qlik.com/t5/Integration-Extension-APIs/WITH-CONNECTION-statement-BODY-with-Double-...

 

Benoit_C
Support
Support

Hi @tayariib85,

It seems like the issue in your script is due to the syntax error in the BODY parameter. You are using double quotes for the JSON body, and also using double quotes in the BODY parameter which causes a syntax error. To resolve this, you can either escape the double quotes in the JSON body, or use single quotes to define the JSON body in the LET statement.

Regards,

Benoit

Benoit_C
Support
Support

Edit: it seems you already solved the issue yourself, thank you a lot for coming back with your solution.