Is Scripted REST API used only for Inbound communications in to ServiceNow ?

Gopi22
Giga Guru

HI,

We are building multiple integrations for our client.

We had this query, are Scripted REST APIs used only for inbound communication in to ServiceNow. Can we use Scripted REST API for Outbound integrations from ServiceNow on to different third party systems ?

Thanks,

Gopi

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Gopi,

Scripted REST APIs are being used in ServiceNow so that an endpoint can be given to 3rd party team.

This endpoint when consumed by 3rd party would perform some operation as defined in the scripted rest API.

It is used for inbound communication to ServiceNow only.

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

8 REPLIES 8

Hi Gopi,

that's correct; you need to share the endpoint and the sample request format

Regards
Ankur

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

Thank you. 

 

But how do we create an incident ticket in our instance ? 

Do you have any script which can be used for the same.

 

Regards,

Gopi

Community Alums
Not applicable

Hi @Gopi22 

 

That's correct, you can get from 'Explore REST API'. 

 

Your rest endpoint should look like below:

https://<instance.service-now.com>/api/<name_space>/<version>/<api_id>/<relative_path>

In this URI:

  • <instance.service-now.com>: Path to the ServiceNow instance where users access the scripted REST API.
  • <name_space>: For web services in the global scope, the name space is the value of the property glide.appcreator.company.code. For web services in a scoped application, the name space is the scope name, such as x_company_appname. For additional information on name spaces, see Application scope.
  • <version>: Optional. Version of the endpoint to access if the API uses versioning, such as v1. You can access the default version of a versioned API by specifying the URI without a version number.
  • <api_id>: Value of the API ID field on the Scripted REST Service form. By default this value is based on the service name.
  • <relative_path>: Relative path defined for the resource in the Scripted REST Service form. Specifying a relative resource path allows you to have multiple resources using the same HTTP method, such as GET, in one web service. For example, a resource may specify the path /{id} when the web service has only one GET resource, or /user/{id} and /message/{id} when the web service has different resources for requesting user and message records.

Though you can get the details of your resource path from resource path field of your scripted rest api.

AbhishekPande1_0-1672987982118.png

 

Please refer below ServiceNow product doc and youtube link for better understanding:

NOTE: Please mark helpful if this helps you in any way to make your understanding better.

 

Thanks

Abhishek Pandey

Community Alums
Not applicable

Hi @Gopi22 

 

That's correct, you can get from 'Explore REST API'. 

 

Your rest endpoint should look like below:

https://<instance.service-now.com>/api/<name_space>/<version>/<api_id>/<relative_path>

In this URI:

  • <instance.service-now.com>: Path to the ServiceNow instance where users access the scripted REST API.
  • <name_space>: For web services in the global scope, the name space is the value of the property glide.appcreator.company.code. For web services in a scoped application, the name space is the scope name, such as x_company_appname. For additional information on name spaces, see Application scope.
  • <version>: Optional. Version of the endpoint to access if the API uses versioning, such as v1. You can access the default version of a versioned API by specifying the URI without a version number.
  • <api_id>: Value of the API ID field on the Scripted REST Service form. By default this value is based on the service name.
  • <relative_path>: Relative path defined for the resource in the Scripted REST Service form. Specifying a relative resource path allows you to have multiple resources using the same HTTP method, such as GET, in one web service. For example, a resource may specify the path /{id} when the web service has only one GET resource, or /user/{id} and /message/{id} when the web service has different resources for requesting user and message records.

Though you can get the details of your resource path from resource path field of your scripted rest api.

AbhishekPande1_0-1672987982118.png

 

Please refer below ServiceNow product doc and youtube link for better understanding:

NOTE: Please mark helpful if this helps you in any way to make your understanding better.

 

Thanks

Abhishek Pandey