JS Callout post request sending error

Not applicable
	var payload = fillTemplate(properties.payload);
	 //print(payload);
	 var headers = { 'Content-Type' : properties.content_type };
	var url = properties.endpoint;
	var myRequest = new Request(url, "POST", headers,payload);
	 var exchange = httpClient.send(req);

and getting below error:

{"fault":{"faultstring":"Execution of JavaScript-Callout failed on line JavaScript_Callout_js#38 with error: Unexpected Type. Expected \"String\" got \"ScriptableMapEntry\"","detail":{"errorcode":"steps.javascript.ScriptExecutionFailedLineNumber"}}}

kindly help me

0 1 440
1 REPLY 1

Hi

It's impossible for us to know what's going wrong. But you can figure it out yourself. The error message is telling you: JavaScript_Callout.js, on line 38, is the source of the error.

What do you have on that line?

I think that the 6 lines you've shown in your post are not complete.

Also, this line:


var exchange = httpClient.send(req);
	

...looks wrong. What is the value of the variable 'req' ? It has not been set, in the code you posted.