Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm using REST connect in Qlik Sense to import data from another application tp Qlik. This connections works successfully, but I need to specify a data range for API to work property.
I need to specify the start date and end date via request body.
API method: post
Request Body:
{ "query": "query {buyer(data: {startDate: \"30-Nov-2022\", endDate: \"2-Dec-2022\"} ) { name, id}}"}
I would like to know is there any alternative which I can specify the parameters in QS script to replace the RequestBody.
Hi @elaineng , in your script, you can try the WITH CONNECTION keyword
The REST Connector supports the WITH CONNECTION keyword, which can be used to override URLs, query parameters and query headers in a connection. The POST body can also be overridden when the POST method has been selected for the connection. WITH CONNECTION allows you to alter some parts of a connection rather than create a separate connection.
Four parameters can be used with the WITH CONNECTION keyword:
The syntax for each parameter is:
Examples:
WITH CONNECTION (
Url "https://localhost:81/northwind2.xml",
QUERY "type" "XML",
QUERY "size" "",
HTTPHEADER "auth_type" "token",
HTTPHEADER "token" "1234123123123",
BODY "Post this");
https://community.qlik.com/t5/Design/REST-connector-Using-WITH-CONNECTION/ba-p/1523257
Hi @elaineng , in your script, you can try the WITH CONNECTION keyword
The REST Connector supports the WITH CONNECTION keyword, which can be used to override URLs, query parameters and query headers in a connection. The POST body can also be overridden when the POST method has been selected for the connection. WITH CONNECTION allows you to alter some parts of a connection rather than create a separate connection.
Four parameters can be used with the WITH CONNECTION keyword:
The syntax for each parameter is:
Examples:
WITH CONNECTION (
Url "https://localhost:81/northwind2.xml",
QUERY "type" "XML",
QUERY "size" "",
HTTPHEADER "auth_type" "token",
HTTPHEADER "token" "1234123123123",
BODY "Post this");
https://community.qlik.com/t5/Design/REST-connector-Using-WITH-CONNECTION/ba-p/1523257
Thanks for the info & link. However, after added with connection as below. QS script loaded 0 row.
I have no error during load and there are information is I load with connection string.
I have managed to load the data after convert all settings into parameters. Thanks.
Excelent @elaineng , that is the idea!