Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
christianborg
Partner - Contributor II
Partner - Contributor II

How can I use the Qlik Sense Engine API to send a POST request, specifically for the 'SendGenericCommandToCustomConnector' operation within the Custom

Hello everyone,

I'm currently working on invoking my RESTful POST API through the Qlik Sense Engine API, but I'm encountering difficulties in making the call. Oddly enough, when I save the Data Connection or perform a connection test using the Data Connection Editor, the API is successfully invoked.

I'm puzzled by the fact that despite these successful tests, I'm receiving a somewhat ambiguous "select ..." message when attempting the call directly through the Qlik Sense Engine API. Any insights into what might be going wrong in my approach would be greatly appreciated.

{
	"handle": 1,
	"method": "SendGenericCommandToCustomConnector",
	"params": {
		"qProvider": "QvRestConnector.exe",
		"qCommand": "GetCustomCaption",
		"qMethod": "POST",
		"qParameters": [
		],
		"qAppendConnection": "Connection Name"
	}
}
{
	"jsonrpc": "2.0",
	"id": 46,
	"delta": true,
	"result": {
		"qResult": "Select..."
	}
}

 

Labels (4)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm not sure you are travelling the right path here.  If you want to POST to the REST endpoint to insert a record, just use http to POST to the endpoint directly, the connection is not required. 

I could assume you have a reason for wanting to use the connector, because it perhaps holds some parameters you want to use. Maybe you are just trying to invoke the "Test Connection" against this connection.

"qMethod" is not an HTTP method like POST. It is a method name defined in the connector. qMethod is used when the qCommand is JsonRequest. 

You can use browser devtools to examine the websocket traffic.  The request from the "Test connection" button would generate a qCommand: "JsonRequest" and qMethod: "testConnection". 

-Rob

View solution in original post

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

What are you trying to do with the connection?

-Rob

christianborg
Partner - Contributor II
Partner - Contributor II
Author

Hi @rwunderlich 

The data connection calls a Rest API that uses a POST method to insert a record in a database.

I would like to call that data connection using such SendGenericCommandToCustomConnector API and ideally change the request body accordingly.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm not sure you are travelling the right path here.  If you want to POST to the REST endpoint to insert a record, just use http to POST to the endpoint directly, the connection is not required. 

I could assume you have a reason for wanting to use the connector, because it perhaps holds some parameters you want to use. Maybe you are just trying to invoke the "Test Connection" against this connection.

"qMethod" is not an HTTP method like POST. It is a method name defined in the connector. qMethod is used when the qCommand is JsonRequest. 

You can use browser devtools to examine the websocket traffic.  The request from the "Test connection" button would generate a qCommand: "JsonRequest" and qMethod: "testConnection". 

-Rob