Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
swilliams11
Contributor
Contributor

WITH CONNECTION - How to sendJSON Payload Body?

I can't get this code to execute successfully.  No matter how many iterations, it will not get the access token value. I know that the vRequestBody is correct, because I can see it printed in the console.  What is the official way to send a JSON payload body in a request with WITH CONNECTION?

LET vRequestBody = '{"authorization":"' & vAuthorizationValue & '"}';
LET vRequestBody = Replace(vRequestBody,'"', '""');

TRACE $(vRequestBody);

RestConnectorMasterTable2:
SQL SELECT
"accesstoken"
FROM JSON (wrap on) "root1"
WITH CONNECTION (
URL "https://api.sensorpush.com/api/v1/oauth/accesstoken",
HTTPHEADER "Content-Type" "application/json",
BODY "$(vRequestBody)"
);

 

 

I've tried escaping the quotes in the JSON body and fiddling with the quotes on the BODY property. But everything either generates an error or does not generate an error and fails to fetch any data.  I've read all the similar posts and tried the different iterations as well, but I have not had any success with this command.

Labels (1)
1 Reply
Suporte_Dalben
Contributor
Contributor

I'm facing the same problem, I'm trying to make a request post of a json through the "With Connection", but the system keeps returning error. Did you manage to solve it? It's as if the system doesn't understand json