Create a REST web service activity
- UpdatedJul 31, 2025
- 10 minutes to read
- Zurich
- Orchestration
Use this procedure to create a custom REST web service Orchestration activity.
Before you begin
Role required: web_service_admin, activity_admin, activity_creator
About this task
- Create a Create a REST message if an appropriate one is not already configured.
- Assign the web_service_admin role to any user who must create or edit a custom REST activity.
- Determine an application, or Application scope, for this activity.
- Determine the Create a REST message to use for the activity. Use this value to override the endpoint configured in the REST message.
- Optionally, create basic authentication credentials. Use this value to override the credentials configured in the SOAP message.
Procedure
What to do next
Finish creating your Rest web service activity by creating output variables, creating a parsing rule, or Conditions. Refer to the create custom activities topic to know your template options.
Auto-map REST activity output variables
The ServiceNow activity designer allows you to map parameter values in a REST test payload to variables in the Outputs stage automatically.
Before you begin
About this task
Procedure
REST template execution parameters
You use execution parameters to create the input process script in the Pre Processing form of the activity designer.
executionParam. prefix with all variables in
this table.| Name | Variable | Type | Usage |
|---|---|---|---|
| Web service message | web_service_message | Reference | The sys_id of the corresponding web service message. |
| Web service message function | web_service_message_function | Reference | The sys_id of the REST message function. |
| Web service endpoint | web_service_endpoint | String | URL of the REST endpoint. |
| Parameters | parameters | Array of JavaScript objects | Array of JavaScript objects, expressed with the
executionParam. prefix. For instructions on creating arrays
using this parameter see Create a JavaScript array in a REST template. |
| Use mid server | use_mid_server | Boolean | Selects whether or not to use the MID Server. A value of true uses the MID Server, and a value of false does not use the MID Server. |
| MidCapabilities | midCapabilities | String (comma separated) | List of references to required MID Server capabilities. |
| Time out | time-out | String | Allowable time out duration, expressed in seconds. |
| ValueCapabilities | valueCapabilities | Array of hashmap | Capability values used to select the MID Server. For more information, see
MID Server capabilities. Use this example to customize the MID Server selection if there are additional
capabilities that are assigned by
value: |
| Auth Type | auth-type | Boolean | Type of credentials to use. The choices are:
|
| Credentials | credentials | Reference | Contains the credentials to use for this REST message when the auth_type selected is basic_auth_pick_credentials. |
Create a JavaScript array in a REST template
These are instructions for creating JavaScript arrays using REST execution parameters.
Before you begin
About this task
To add more name-value pairs to the parameter's array, append the values to the existing array.
Procedure
REST template post-processing parameters
Use these parameters to create a post-processing script.
| Name | Variable | Type | Usage |
|---|---|---|---|
| Status code | status_code | Integer | Contains the status code returned from the REST web service. |
| Header | header | Hashmap of JavaScript object | Hashmap of key value pairs associated with the header values passed into the
web service. You can access each value with
executionResult.header[keyName]. |
| Body | body | String | Contains a string value representing the output from the REST message |
| Error | error | String | Returns the error string from the REST web service, unless there are no errors, in which case it returnsnull. |
Configure the REST execution command
Use the input variables you created to configure the command that Orchestration executes on the REST endpoint.
Before you begin
Role required: web_service_admin, activity_admin, activity_creator
Procedure