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:
Syntax | Description | Example |
---|---|---|
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
- Choose in the tool bar.
- Fill any part of the name of the component, for example
Inbound
, into the filter cell of the Name column. - Locate the component, choose Install Specific Version from the context-menu.
- Select the version you wish to install, in this example, 1.0.0.1:
- Choose Install
<version>
, in this example install version 1.0.0.1.
Contents of the Component
Object Type | Name |
---|---|
Application | GLOBAL.Redwood/REDWOOD.RestService |
Extension Point | REDWOOD.Redwood_RestService |
Library | REDWOOD.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 exampleexample/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 serverstart
- Start a process serverrestart
- 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 sourcedisable
- 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 asJobDefinition
for process definition,JobChain
for chain definition,EventDefinition
for event definition orTimeWindow
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>
- POST to
- Raise an Event
- POST to
<url>/Event/<event_definition_partition>.<event_definition_name>
- POST to
- 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
- POST to
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
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:
Syntax | Description | Example |
---|---|---|
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
- Connectivity from the central Redwood server to the REST host on its port
- Connectivity from the secure gateway to the REST host on its port
Setup
- Choose in the tool bar.
- Fill any part of the name of the component, for example
Inbound
, into the filter cell of the Name column. - Locate the component, choose Install Specific Version from the context-menu.
- Select the version you wish to install, in this example, 1.0.0.1:
- Choose Install
<version>
, in this example install version 1.0.0.1.
Contents of the Component
Object Type | Name |
---|---|
Application | GLOBAL.Redwood/REDWOOD.RestService |
Extension Point | REDWOOD.Redwood_RestService |
Library | REDWOOD.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 exampleexample/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 asJobDefinition
for process definition,JobChain
for chain definition,EventDefinition
for event definition orTimeWindow
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 areclear
(to clear the currently raised event from the event definition) andclearAllPending
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 caseclear
.
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.