TMF 641 API call in servicenow

komalsalunke
Tera Contributor

I want to call TMF641 API in ServiceNow to create customer order.

I have built the payload in ServiceNow. I am trying to pass the payload to it but I am getting error. 

 

var rest = new sn_ws.RESTMessageV2();
        rest.setEndpoint('api/sn_ind_tmt_orm/serviceorder');
        rest.setHttpMethod('post');
        rest.setRequestHeader('Accept', 'application/json');
        rest.setRequestHeader('Content-Type', 'application/json');
        rest.setRequestBody(JSON.stringify(request));
        var response = rest.execute();
        var responseBody = response.getBody();
 
 
Do I need to give authentication as well?
 
4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@komalsalunke 

so you are consuming 3rd party API?

If yes then did you check if they are expecting any authentication?

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I am not using third party API - it is OOTB API present in serivcenow .which I want to consume in serivcenow itself.

@komalsalunke 

Since it's an API within ServiceNow, then yes you need to use some API user and authentication

You can use Basic Authentication

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Chaitanya ILCR
Kilo Patron

Hi @komalsalunke ,

 

since it's OOB, yes Authentication is required.

if it was a scripted Rest You will have option to skip authentication

ChaitanyaILCR_0-1748276367352.png

just sharing this info it's not recommended to create such APIs. 

 

what's your use case? what are trying to achieve? and why this route why not server side code to create whatever you are trying to create?

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya