Redwood Documentation

Product Documentation

 

›Inbound REST

Separate ComponentsGeneric Components

Catalog

  • Catalog

Connectors

  • Connections
  • Azure Subscriptions
  • Azure DataFactory
  • JSCAPE Component
  • IBM z/OS
  • Box Connector
  • Sharepoint
  • Informatica
  • Cognos
  • ServiceNow

Inbound REST

  • REST Services
  • API Key

Excel

  • Generic Excel Components

Platform Agent

  • Core Platform Functions

Oracle Data Services

  • Oracle Data Integrator

SAP Data Services

  • BTP Cloud Integration
  • SAP CI DS
  • SAP IBP
  • BusinessObjects
  • SAP SNC

SLA

  • SLA Component Installation
  • SLA Rules
  • SLA Dashboard
  • Advanced Configuration

On-Premises SSO

  • SSO Module

Privileges Required

  • Azure Subscriptions
  • Box Connections
  • Catalog
  • Connections
  • Azure Data Factory
  • Sharepoint
  • Informatica
  • REST Services
  • JSCAPE Connector
  • API Keys
  • Excel
  • ODI Connections
  • Queues
  • CloudIntegration Connections
  • HCI DS Connections
  • IBP Connections
  • SLA
  • ServiceNow
  • z/OS Connections
← ServiceNowAPI Key →

REST Services Component

Introduction

The REST Services component exposes definitions to a REST interface. The main difference with the built-in REST interface (api-rest) is that this service uses an API key for authentication that you specify in the X-API-Key header, for example X-API-Key: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD (see the cURL examples below), whereas the built-in REST interface uses basic authentication.

The following actions are supported:

SyntaxDescriptionExample
GET <object>/<business_key>Retrieve a JSON representation of an object.GET /api-extension/External/Redwood_RestService/rest/v1/JobDefinition/System_Sleep
POST <object>/<business_key>Create an object, based on the JSON you post
For Job, if you specify a process definition name, it will create a new process from the process definition with default parameters.
POST /api-extension/External/Redwood_RestService/rest/v1/JobDefinition/System_Sleep
PUT <object>/<business_key>[/<action>]Perform an update or an action on an existing object.PUT /api-extension/External/Redwood_RestService/rest/v1/Job/123/hold
DELETE <object>/<business_key>Delete an existing object.DELETE /api-extension/External/Redwood_RestService/rest/v1/Job/123
note

These actions are different to the built-in REST interface.

New Features in 1.0.0.2

  • Cancel Process Recurrences
  • Update Processes with External Completion Strategy
  • Choose what fields are returned when submitting a Process
  • Reply to an Operator Message
  • Reply to a User Message
  • Reply to an Alert
  • Start/Stop/Restart Process Servers
  • Import a car file
  • Download JobFile Contents
  • Enable/Disable Alert Sources
  • GET, Create (POST), Update (PUT), and DELETE Credentials
  • Updated Queue Provider handling for Process Servers. Now, Queue Providers are ignored on PUT/POST requests to the process server endpoints. Use POST/PUT/DELETE methods to the QueueProvider resource to create, update, or delete queue providers.

Prerequisites

  • Platform Version 9.2.9 or greater
  • API Key component version 1.0.0.2 or greater (dependency handled by the Catalog automatically)
  • Privileges Required to use REST services

Setup

  1. Choose in the tool bar.
  2. Fill any part of the name of the component, for example Inbound, into the filter cell of the Name column.
  3. Locate the component, choose Install Specific Version from the context-menu.
  4. Select the version you wish to install, in this example, 1.0.0.1:
  5. Choose Install <version>, in this example install version 1.0.0.1.


Contents of the Component

Object TypeName
ApplicationGLOBAL.Redwood/REDWOOD.RestService
Extension PointREDWOOD.Redwood_RestService
LibraryREDWOOD.Redwood_RestService

Create an API Key for Authorization

URL Syntax

The URL to call depends on the URL to your environment:

http[s]://<server>[:<port>]/<context>/api-extension/External/REDWOOD/Redwood_RestService/rest/v1/

Where

  • <server> - the FQDN of the Redwood server.
  • <port> - (optional) the port the server is listening on; defaults to the default port of the protocol (80 for HTTP, 443 for HTTPS).
  • <context> - the server context, redwood by default for on-site installations, <company_name>/<environment> for cloud environments, for example example/test.

Example URL's

An API key is required to make REST calls.

https://s1.example.local/redwood/api-extension/External/REDWOOD/Redwood_RestService/rest/v1
https://s1.example.local:8443/redwood/api-extension/External/REDWOOD/Redwood_RestService/rest/v1
https://dublin.runmyjobs.cloud/example/test/api-extension/External/REDWOOD/Redwood_RestService/rest/v1

Swagger Documentation

Swagger documentation is available at the below URL, no API key required to access the documentation:

http[s]://<server>[:<port>]/<context>/api-extension/External/REDWOOD/Redwood_RestService/rest/swagger.yml

For example:

https://redwood.example.com/redwood/api-extension/External/REDWOOD/Redwood_RestService/rest/swagger.yml

https://dublin.runmyjobs.cloud/example/test/api-extension/External/REDWOOD/Redwood_RestService/rest/swagger.yml

GET

GET retrieves a JSON representation of objects. The user must have the privileges to view the object in question and any objects it references.

Syntax

<url>/<object_type>/<partition>.<name>

PUT

PUT takes zero or more JSON formatted properties and updates an object; it also allows you to perform actions on processes. The user must have the privileges to perform the modification and/or actions.

Syntax

Processes:

<url>/Job/<job_id>/<action>
  • cancel - Cancels a process in a pre-running state.
    • use the cancelRecurrence=true parameter to also cancel all recurrences for the job - /Job/<job_id>/cancel?cancelRecurrence=true
  • kill - Kills a process in a running state.
  • unknown - Sets a process to status Unknown.
  • hold - Holds a process in a pre-running state.
  • release - Releases a held process.
  • disable - Disables a step or call in a chain.
  • enable - Enables a step or call in a chain.
  • restart - Restart a process.
  • resubmit - (default) Resubmits a process, any process properties provided in the JSON file are applied to the process.
  • runnow - Forces a process to ignore any events, locks or schedules, and start running immediately.
  • updateJob - Update Status, Description, JobNotes, or Job Parameters for jobs with an External completion strategy.

Operator Messages

<url>/OperatorMessage/<operatormessage_id>/<action>
  • reply - Reply to an operator message. Send a JSON object in the request body with this syntax
 { “Reply”: “MyReplyChoice“ }

User Messages

<url>/UserMessage/<usermessage_id>/<action>
  • reply - Reply to a User Message. Send a JSON object in the request body with this syntax
 {
    "Response": “MyResponseChoice“,
    "ReplyComment": "My reply comment"
  }

Alerts

<url>/Alert/<alert_id>/<action>
  • reply - Reply to an Alert. Send a JSON object in the request body with this syntax
 { "Response": “Acknowledge“ }

Process Servers

<url>/ProcessServer/<partition>.<name>/<action>
  • stop - Stop a process server
  • start - Start a process server
  • restart - Restart a process server

Alert Sources

Process Server Alert Sources
<url>/ProcessServerAlertSource/<partition>.<name>/<action>

Process Alert Sources
<url>/JobDefinitionAlertSource/<partition>.<name>/<action>
  • enable - Enable the alert source
  • disable - Disable the alert source

POST

POST takes an JSON body and creates an object. The user must have the privileges to perform the actions.

Syntax

<url>/<object_type>/<partition>.<name>

<url>/EventDefinition/<event_definition_name>/<event_definition_action>
<url>/Event/<event_id>/<event_action>

where:

  • <url> - The base URL, see above.
  • <object_type> - The technical name of the object type, such as JobDefinition for process definition, JobChain for chain definition, EventDefinition for event definition or TimeWindow for time window.
  • <partition> - The name of the partition of the object.
  • <name> - The name of the object.

Special Cases

  • Submit a Job
    • POST to <url>/Job/<job_definition_partition>.<job_definition_name>
  • Raise an Event
    • POST to <url>/Event/<event_definition_partition>.<event_definition_name>
  • Import CAR file
    • POST to <url>/Import
    • Headers
      • content-type=application/octet-stream
    • Query Parameters (all are optional):
      • TargetPartition: The name of the Partition to import into
      • WaitForCompletion: true|false - When true, the request will wait until the import completes before returning. If it completes successfully, you will receive a 200 response code. If it fails, you will receive a 500 response code. When false, the request will return immediatley after starting the import. It will return 200 if the import is started successfully, but that does not guarantee that the import completed successfully.
      • ImportRuleSet: PARTITION.Name format. The importruleset to apply to the import.
      • fileName: The filename of the car file being imported. This is only used in the UI for logging purposes.
    • Request Body: The car file in binary format

DELETE

DELETE deletes an object. The user must have the privileges to delete the object.

Syntax

<url>/<object_type>/<partition>.<name>

cURL Examples

POST to Job

#!/bin/bash

API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X POST -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/System_Sleep?fields=uniqueId,jobId,status"
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl.exe -X POST -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/System_Sleep?fields=uniqueId,jobId,status"

Examples (Bash and Powershell) illustrating submitting System_Sleep with default parameters. Use the 'fields' query parameter to control what fields are returned. If omitted, all fields are returned.

PUT to Job

#!/bin/bash

API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d - <<EOF
{
  "RequestedStartTime": "2023/09/28 17:00:00,000 Europe/Paris",
  "Description": "Submitted from REST Services using cURL"
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"RequestedStartTime\": \"2023/09/28 17:00:00,000 Europe/Paris\",
  \"Description\": \"Submitted from REST Services using cURL\"
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d "$JSON"

Examples illustrating resubmitting process 123 at 5 PM Paris time on 2023/09/28.

PUT to Resubmit a Process Setting a Parameter

#!/bin/bash

URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d - <<EOF
{
  "RequestedStartTime": "2023/09/28 17:00:00,000 Europe/Paris",
  "Description": "Submitted from REST Services using cURL",
  "JobParameters": [
   {
      "InValueDate": null,
      "InValueNumber": 10000,
      "InValueString": "1000",
      "JobDefinitionParameter": "JobDefinitionParameter:GLOBAL.System_Sleep.MilliSeconds",
      "OutValueDate": null,
      "OutValueNumber": null,
      "OutValueString": null
    }
  ]
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"RequestedStartTime\": \"2023/09/28 17:00:00,000 Europe/Paris\",
  \"Description\": \"Submitted from REST Services using cURL\",
  \"JobParameters\": [
   {
      \"InValueDate\": null,
      \"InValueNumber\": 10000,
      \"InValueString\": \"1000\",
      \"JobDefinitionParameter\": \"JobDefinitionParameter:GLOBAL.System_Sleep.MilliSeconds\",
      \"OutValueDate\": null,
      \"OutValueNumber\": null,
      \"OutValueString\": null
    }
  ]
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d "${JSON}"

Examples illustrating resubmitting process 123 at 5 PM Paris time on 2023/09/28 with parameter MilliSeconds set to 10000.

PUT to Modify a Queue

#!/bin/bash

API_KEYk="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Queue/MyQueue" -d - <<EOF
{
  "Held": true
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"Held\": true
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Queue/MyQueue" -d "${JSON}"

Examples illustrating closing queue MyQueue.

PUT to Modify a QueueProvider

#!/bin/bash

API_KEYk="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/QueueProvider/Global.MyProcessServer.Global.MyQueue" -d - <<EOF
{
  "Held": true
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"Held\": true
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/QueueProvider/Global.MyProcessServer.Global.MyQueue" -d "${JSON}"

Examples illustrating closing queue provider for MyProcessServer serving MyQueue.

Delete a Process

API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
curl -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" | jq ."Description",."Documentation"

#This call retrieves the process and jq extracts the Definition and Documentation fields, for example:
# "DeleteMe"
# "Example process to be deleted"

#Actual deletion, note that we get no response for successful deletions
curl -X DELETE -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123"

#Now we try to retrieve it and we get an HTTP 404 - it was successfully deleted
curl -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123"
# This call would return this
#{
#  "code":"404",
#  "message":"Unable to find object Job:123"
#}

Example illustrating how to delete a JobDefinition.

PUT to Update a Process with an External Completion Strategy

#!/bin/bash

API_KEYk="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/12345/updateJob" -d - <<EOF
{
  "Status": "Completed",
  "JobNotes": [
    "Note 1",
    "Note 2"
  ],
  "JobParameters": [
   {
      "Name": "OutString",
      "OutValue": "My String Value"
    },
    {
      "Name": "OutNumber",
      "OutValue": 12345
    }
  ]
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"Status\": \"Completed\",
  \"JobNotes\": [
    \"Note 1\",
    \"Note 2\"
  ],
  \"JobParameters\": [
   {
      \"Name": \"OutString\",
      \"OutValue": \"My String Value\"
    },
    {
      \"Name\": \"OutNumber\",
      \"OutValue\": 12345
    }
  ]
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/12345/updateJob" -d "${JSON}"

Examples illustrating updating Status, Description, Job Notes, and Job Parameters for Process with id 12345.

GET contents of a Job File

#!/bin/bash

API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X GET -H "${API_KEY}" "${URL}/JobFile/<jobFile_unique_id>/content"
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl.exe -X POST -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/JobFile/<jobFile_unique_id>/content"

Examples (Bash and Powershell) illustrating fetching the contents of a Job File with unique id = 12345. The content-type header should match the

See Also

Built-in REST Interface

Introduction

The REST Services component exposes definitions to a REST interface. The main difference with the built-in REST interface (api-rest) is that this service uses an API key for authentication that you specify in the X-API-Key header, for example X-API-Key: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD (see the cURL examples below), whereas the built-in REST interface uses basic authentication.

The following actions are supported:

SyntaxDescriptionExample
GET <object>/<business_key>Retrieve a JSON representation of an object.GET /api-extension/External/Redwood_RestService/rest/v1/JobDefinition/System_Sleep
POST <object>/<business_key>Change an object, based on the JSON you post
For Job, if you specify a process definition name, it will create a new process from the process definition with default parameters.
POST /api-extension/External/Redwood_RestService/rest/v1/JobDefinition/System_Sleep
PUT <object>/<business_key>[/<action>]Perform an action on an existing object.PUT /api-extension/External/Redwood_RestService/rest/v1/Job/123/hold
DELETE <object>/<business_key>Delete an existing object.DELETE /api-extension/External/Redwood_RestService/rest/v1/Job/123
note

These actions are different to the built-in REST interface.

Prerequisites

  • API Key component (dependency handled by the Catalog automatically)
  • Privileges Required to use REST services
  • on-site-related topic Connectivity from the central Redwood server to the REST host on its port
  • cloud-related topic Connectivity from the secure gateway to the REST host on its port

Setup

  1. Choose in the tool bar.
  2. Fill any part of the name of the component, for example Inbound, into the filter cell of the Name column.
  3. Locate the component, choose Install Specific Version from the context-menu.
  4. Select the version you wish to install, in this example, 1.0.0.1:
  5. Choose Install <version>, in this example install version 1.0.0.1.


Contents of the Component

Object TypeName
ApplicationGLOBAL.Redwood/REDWOOD.RestService
Extension PointREDWOOD.Redwood_RestService
LibraryREDWOOD.Redwood_RestService

Create an API Key for Authorization

URL Syntax

The URL to call depends on the URL to your environment:

http[s]://<server>[:<port>]/<context>/api-extension/External/REDWOOD/Redwood_RestService/rest/v1/

Where

  • <server> - the FQDN of the Redwood server.
  • <port> - (optional) the port the server is listening on; defaults to the default port of the protocol (80 for HTTP, 443 for HTTPS).
  • <context> - the server context, redwood by default for on-site installations, <company_name>/<environment> for cloud environments, for example example/test.

Example URL's

An API key is required to make REST calls.

https://s1.example.local/redwood/api-extension/External/REDWOOD/Redwood_RestService/rest/v1
https://s1.example.local:8443/redwood/api-extension/External/REDWOOD/Redwood_RestService/rest/v1
https://dublin.runmyjobs.cloud/example/test/api-extension/External/REDWOOD/Redwood_RestService/rest/v1

Swagger Documentation

Swagger documentation is available at the below URL, no API key required to access the documentation:

http[s]://<server>[:<port>]/<context>/api-extension/External/REDWOOD/Redwood_RestService/rest/swagger.yml

For example:

https://redwood.example.com/redwood/api-extension/External/REDWOOD/Redwood_RestService/rest/swagger.yml

https://dublin.runmyjobs.cloud/example/test//api-extension/External/REDWOOD/Redwood_RestService/rest/swagger.yml

GET

GET retrieves a JSON representation of objects. The user must have the privileges to view the object in question and any objects it references.

Syntax

<url>/<object_type>/<partition>.<name>

PUT

PUT takes zero or more JSON formatted properties and updates an object; it also allows you to perform actions on processes. The user must have the privileges to perform the modification and/or actions.

Syntax

<url>/<object_type>/<partition>.<name>
<url>/Job/<job_id>/<action>

The following actions are supported on processes:

  • cancel - Cancels a process in a pre-running state.
  • kill - Kills a process in a running state.
  • unknown - Sets a process to status Unknown.
  • hold - Holds a process in a pre-running state.
  • release - Releases a held process.
  • disable - Disables a step or call in a chain.
  • enable - Enables a step or call in a chain.
  • restart - Restart a process.
  • resubmit - (default) Resubmits a process, any process properties provided in the JSON file are applied to the process.
  • runnow - Forces a process to ignore any events, locks or schedules, and start running immediately.

POST

POST takes an optional JSON file and performs an action on an object. The user must have the privileges to perform the actions.

Syntax

<url>/<object_type>/<partition>.<name>
<url>/Job/<job_definition_name>
<url>/EventDefinition/<event_definition_name>/<event_definition_action>
<url>/Event/<event_id>/<event_action>

where:

  • <url> - The base URL, see above.
  • <object_type> - The technical name of the object type, such as JobDefinition for process definition, JobChain for chain definition, EventDefinition for event definition or TimeWindow for time window.
  • <partition> - The name of the partition of the object.
  • <name> - The name of the object.
  • <job_definition_name> - The name of a process definition, uses the format <partition>.<name>.
  • <event_definition_name> - The name of a event definition, uses the format <partition>.<name>.
  • <event_definition_action> - The action to perform on the event, actions supported are clear (to clear the currently raised event from the event definition) and clearAllPending to clear the pending events of this event definition.
  • <event_id> - The ID of the event, using syntax <name><raise_sequence>.
  • <event_action> - the action to perform on the event, in this case clear.

There must be an object of the specified type with the specified partition and name, except for Job and Event, the two interact with process definitions (submit) and event definitions (raise), respectively.

DELETE

DELETE deletes an object. The user must have the privileges to delete the object.

Syntax

<url>/<object_type>/<partition>.<name>

cURL Examples

POST to Job

#!/bin/bash

API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X POST -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/System_Sleep"
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl.exe -X POST -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/System_Sleep"

Examples (Bash and Powershell) illustrating submitting System_Sleep with default parameters.

PUT to Job

#!/bin/bash

API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d - <<EOF
{
  "RequestedStartTime": "2023/09/28 17:00:00,000 Europe/Paris",
  "Description": "Submitted from REST Services using cURL"
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"RequestedStartTime\": \"2023/09/28 17:00:00,000 Europe/Paris\",
  \"Description\": \"Submitted from REST Services using cURL\"
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d "$JSON"

Examples illustrating resubmitting process 123 at 5 PM Paris time on 2023/09/28.

PUT to Resubmit a Process Setting a Parameter

#!/bin/bash

URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d - <<EOF
{
  "RequestedStartTime": "2023/09/28 17:00:00,000 Europe/Paris",
  "Description": "Submitted from REST Services using cURL",
  "JobParameters": [
   {
      "InValueDate": null,
      "InValueNumber": 10000,
      "InValueString": "1000",
      "JobDefinitionParameter": "JobDefinitionParameter:GLOBAL.System_Sleep.MilliSeconds",
      "OutValueDate": null,
      "OutValueNumber": null,
      "OutValueString": null
    }
  ]
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"RequestedStartTime\": \"2023/09/28 17:00:00,000 Europe/Paris\",
  \"Description\": \"Submitted from REST Services using cURL\",
  \"JobParameters\": [
   {
      \"InValueDate\": null,
      \"InValueNumber\": 10000,
      \"InValueString\": \"1000\",
      \"JobDefinitionParameter\": \"JobDefinitionParameter:GLOBAL.System_Sleep.MilliSeconds\",
      \"OutValueDate\": null,
      \"OutValueNumber\": null,
      \"OutValueString\": null
    }
  ]
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" -d "${JSON}"

Examples illustrating resubmitting process 123 at 5 PM Paris time on 2023/09/28 with parameter MilliSeconds set to 10000.

PUT to Modify a Queue

#!/bin/bash

API_KEYk="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Queue/MyQueue" -d - <<EOF
{
  "Held": true
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"Held\": true
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Queue/MyQueue" -d "{JSON}"

Examples illustrating closing queue MyQueue.

PUT to Modify a QueueProvider

#!/bin/bash

API_KEYk="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"

curl -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/QueueProvider/Global.MyProcessServer.Global.MyQueue" -d - <<EOF
{
  "Held": true
}
EOF
#Windows Powershell and Windows' curl.exe

$API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
$URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
$JSON=@'
{
  \"Held\": true
}
'@

curl.exe -X PUT -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/QueueProvider/Global.MyProcessServer.Global.MyQueue" -d "{JSON}"

Examples illustrating closing queue provider for MyProcessServer serving MyQueue.

Delete a Process

API_KEY="X-API-KEY: Nluw0OaBA9T+3wgmv6fx1ZSIsBMt+NCfEUbQsveswBgGZyul+qZ75mIemTzgVyqsGPzpNg9O46B1//TMwh4edekD"
URL="https:/s1.example.local/redwood/api-extension/External/Redwood_RestService/rest/v1"
curl -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123" | jq ."Description",."Documentation"

#This call retrieves the process and jq extracts the Definition and Documentation fields, for example:
# "DeleteMe"
# "Example process to be deleted"

#Actual deletion, note that we get no response for successful deletions
curl -X DELETE -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123"

#Now we try to retrieve it and we get an HTTP 404 - it was successfully deleted
curl -H "${API_KEY}" -H "Content-Type: application/json" "${URL}/Job/123"
# This call would return this
#{
#  "code":"404",
#  "message":"Unable to find object Job:123"
#}

Example illustrating how to delete a JobDefinition.

See Also

Built-in REST Interface

← ServiceNowAPI Key →
  • Introduction
  • New Features in 1.0.0.2
  • Prerequisites
  • Setup
  • Contents of the Component
  • Create an API Key for Authorization
  • URL Syntax
    • Example URL's
    • Swagger Documentation
  • GET
    • Syntax
  • PUT
    • Syntax
  • POST
    • Syntax
  • DELETE
    • Syntax
  • cURL Examples
    • POST to Job
    • PUT to Job
    • PUT to Resubmit a Process Setting a Parameter
    • PUT to Modify a Queue
    • PUT to Modify a QueueProvider
    • Delete a Process
    • PUT to Update a Process with an External Completion Strategy
    • GET contents of a Job File
  • See Also
  • Introduction
  • Prerequisites
  • Setup
  • Contents of the Component
  • Create an API Key for Authorization
  • URL Syntax
    • Example URL's
    • Swagger Documentation
  • GET
    • Syntax
  • PUT
    • Syntax
  • POST
    • Syntax
  • DELETE
    • Syntax
  • cURL Examples
    • POST to Job
    • PUT to Job
    • PUT to Resubmit a Process Setting a Parameter
    • PUT to Modify a Queue
    • PUT to Modify a QueueProvider
    • Delete a Process
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |