Outbound Rest API throwing error

balaji_prusty1
Giga Guru

Hi Team,

 

I need to integrate SNOW to SNOW using App Studio. I have created Outbound REST (POST) to send data. When I test this connection in  REST Messages, it works and gives 201 (success). 

 

balaji_prusty1_0-1711384822207.png

 

But when I try to use it in the Script-include it gives the error "function getStatusCode() {[native code, arity=0]}"

 

Here is the Below script that I am passing through Script-Include but getting error "function getStatusCode() {[native code, arity=0]}"

===============================

var r = new sn_ws.RESTMessageV2('API Integration', 'Acknowledge Service Ticket');
r.setStringParameterNoEscape('TicketNumber', current.u_external_ticket_no);
r.setStringParameterNoEscape('CustomerTicketNumber', current.number);
gs.info(r);
var response = r.executeAsync();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode;
gs.info(httpStatus);
var parser = new global.JSON();
var responseObj = parser.decode(responseBody);
return responseObj;

=========================

Need help on this, if anyone found this issue and a solution for this.

 

Thanks

Balaji Prusty

2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

I think you missed a bracket in below line for getStatusCode()

var httpStatus = response.getStatusCode;


Please mark this response as correct or helpful if it assisted you with your question.

Thanks, Sanjiv,

 

After fix the bracket, now getting the error "Status code from Taliom: 500" but when I test in Outbound Test (post) it is working fine.

 

Onle diff b/w outbound rest and script include is "r.executeAsync()".  In the scoped app it is asking to use "executeAsync()" but when I generate the script in outbound rest it is showing "r.execute()".

 

Can you please help why error 500 is throwing.

 

Thanks

Balaji Prusty