Skip to main content

Resource Job Actions

https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID

Below are the various requests that can be performed against the Resource Job resource, as well as the expected parameters and the potential responses.

Cancel Execution​

Marks a specific resource job execution for cancellation

Method And Url​

POST https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID/cancelExecution

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.cancelExecution.

Request Path Components​

Path ComponentDescriptionExample
APPLICATION_IDID associated with the application575ec8687ae143cd83dc4a97
RESOURCE_JOB_IDID associated with the resource job575ec8687ae143cd83dc4a97

Request Query Parameters​

NameRequiredDescriptionDefaultExample
executionIdYThe ID of the execution to cancelexecutionId=632e18632f59592e773a4153

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X POST \
https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID/cancelExecution?executionId=632e18632f59592e773a4153

Successful Responses​

CodeTypeDescription
200SuccessIf the execution was successfully marked for cancellation

Error Responses​

CodeTypeDescription
400ErrorError if malformed request
404ErrorError if execution was not found

Delete​

Deletes a resource job

Method And Url​

DELETE https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.delete.

Request Path Components​

Path ComponentDescriptionExample
APPLICATION_IDID associated with the application575ec8687ae143cd83dc4a97
RESOURCE_JOB_IDID associated with the resource job575ec8687ae143cd83dc4a97

Request Query Parameters​

NameRequiredDescriptionDefaultExample
includeWorkflowsNIf the workflows that trigger from this resource job should also be deleted.includeWorkflows=true

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X DELETE \
https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID

Successful Responses​

CodeTypeDescription
200SuccessIf resource job was successfully deleted

Error Responses​

CodeTypeDescription
400ErrorError if malformed request
404ErrorError if resource job was not found

Execute​

Queues the execution of a resource job

Method And Url​

POST https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID/execute

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.execute.

Request Path Components​

Path ComponentDescriptionExample
APPLICATION_IDID associated with the application575ec8687ae143cd83dc4a97
RESOURCE_JOB_IDID associated with the resource job575ec8687ae143cd83dc4a97

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Request Body​

The body of the request should be serialized JSON that validates against the Resource Job Execution Options schema. For example, the following would be a valid body for this request:

{
"templateContext": "{ \"myData\": 123 }"
}

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X POST \
-d '{"templateContext":"{ \"myData\": 123 }"}' \
https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID/execute

Successful Responses​

CodeTypeDescription
200Success With Execution IDIf the job was successfully queued

Error Responses​

CodeTypeDescription
400ErrorError if malformed request
404ErrorError if resource job was not found

Get​

Returns a resource job

Method And Url​

GET https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.get.

Request Path Components​

Path ComponentDescriptionExample
APPLICATION_IDID associated with the application575ec8687ae143cd83dc4a97
RESOURCE_JOB_IDID associated with the resource job575ec8687ae143cd83dc4a97

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X GET \
https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID

Successful Responses​

CodeTypeDescription
200Resource JobA single resource job

Error Responses​

CodeTypeDescription
400ErrorError if malformed request
404ErrorError if application was not found

Logs​

Retrieves information on resource job executions

Method And Url​

GET https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID/logs

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.logs.

Request Path Components​

Path ComponentDescriptionExample
APPLICATION_IDID associated with the application575ec8687ae143cd83dc4a97
RESOURCE_JOB_IDID associated with the resource job575ec8687ae143cd83dc4a97

Request Query Parameters​

NameRequiredDescriptionDefaultExample
limitNMax log entries to return (ordered by time descending)1limit=10
sinceNLook for log entries since this time (ms since epoch)since=1465790400000

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X GET \
https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID/logs

Successful Responses​

CodeTypeDescription
200Resource Job Execution LogsResource job execution information

Error Responses​

CodeTypeDescription
400ErrorError if malformed request
404ErrorError if resource job was not found

Patch​

Update a resource job

Method And Url​

PATCH https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.patch.

Request Path Components​

Path ComponentDescriptionExample
APPLICATION_IDID associated with the application575ec8687ae143cd83dc4a97
RESOURCE_JOB_IDID associated with the resource job575ec8687ae143cd83dc4a97

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Request Body​

The body of the request should be serialized JSON that validates against the Resource Job Patch schema. For example, the following would be a valid body for this request:

{
"name": "Example Resource Job",
"queryJson": "{ \"name\": \"my device\"}"
}

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X PATCH \
-d '{"name":"Example Resource Job","queryJson":"{ \"name\": \"my device\"}"}' \
https://api.app.wnology.io/applications/APPLICATION_ID/resource-jobs/RESOURCE_JOB_ID

Successful Responses​

CodeTypeDescription
201Resource JobSuccessfully updated resource job

Error Responses​

CodeTypeDescription
400ErrorError if malformed request
404ErrorError if resource job was not found

Schemas​

Error​

Schema for errors returned by the API

Error Schema​

  • ▶
    {} 3 keys
    • "http://json-schema.org/draft-07/schema#"
    • "object"
    • ▶
      {} 2 keys
      • ▶
        {} 1 key
        • ▶
          {} 1 key

      Error Example​

      • ▶
        {} 2 keys
        • "NotFound"
        • "Application was not found"

      Resource Job​

      Schema for a single resource job

      Resource Job Schema​

      • ▶
        {} 4 keys
        • "http://json-schema.org/draft-07/schema#"
        • "object"
        • ▶
          {} 19 keys
          • ▶
            {} 2 keys
            • ▶
              {} 2 keys
              • ▶
                {} 3 keys
                • ▶
                  {} 2 keys
                  • ▶
                    {} 2 keys
                    • ▶
                      {} 1 key
                      • ▶
                        {} 2 keys
                        • ▶
                          {} 2 keys
                          • ▶
                            {} 2 keys
                            • ▶
                              {} 3 keys
                              • ▶
                                {} 3 keys
                                • ▶
                                  {} 2 keys
                                  • ▶
                                    {} 2 keys
                                    • ▶
                                      {} 2 keys
                                      • ▶
                                        {} 2 keys
                                        • ▶
                                          {} 1 key
                                          • ▶
                                            {} 1 key
                                            • ▶
                                              {} 3 keys
                                              • ▶
                                                {} 3 keys
                                              • false

                                            Resource Job Example​

                                            • ▶
                                              {} 11 keys
                                              • "Example Resource Job"
                                              • 60
                                              • 60000
                                              • "{}"
                                              • "6328c6c026517badf9142116"
                                              • 1
                                              • "2022-09-19T19:45:04.453Z"
                                              • "2022-09-19T19:45:04.453Z"
                                              • "6328c6c026517badf914211a"
                                              • "device"
                                              • "{ "name": "my device"}"

                                            Resource Job Execution Logs​

                                            Schema for a set of Resource Job execution logs

                                            Resource Job Execution Logs Schema​

                                            • ▶
                                              {} 3 keys
                                              • "http://json-schema.org/draft-07/schema#"
                                              • "array"
                                              • ▶
                                                {} 6 keys

                                              Resource Job Execution Logs Example​

                                              • ▶
                                                [] 1 item
                                                • ▶
                                                  {} 14 keys

                                                Resource Job Execution Options​

                                                Schema for a resource job execution configuration

                                                Resource Job Execution Options Schema​

                                                • ▶
                                                  {} 4 keys
                                                  • "http://json-schema.org/draft-07/schema#"
                                                  • "object"
                                                  • ▶
                                                    {} 3 keys
                                                    • ▶
                                                      {} 2 keys
                                                      • ▶
                                                        {} 2 keys
                                                        • ▶
                                                          {} 1 key
                                                        • false

                                                      Resource Job Execution Options Example​

                                                      • ▶
                                                        {} 1 key
                                                        • "{ "myData": 123 }"

                                                      Resource Job Patch​

                                                      Schema for a resource job update

                                                      Resource Job Patch Schema​

                                                      • ▶
                                                        {} 4 keys
                                                        • "http://json-schema.org/draft-07/schema#"
                                                        • "object"
                                                        • ▶
                                                          {} 12 keys
                                                          • ▶
                                                            {} 3 keys
                                                            • ▶
                                                              {} 2 keys
                                                              • ▶
                                                                {} 1 key
                                                                • ▶
                                                                  {} 2 keys
                                                                  • ▶
                                                                    {} 2 keys
                                                                    • ▶
                                                                      {} 3 keys
                                                                      • ▶
                                                                        {} 3 keys
                                                                        • ▶
                                                                          {} 2 keys
                                                                          • ▶
                                                                            {} 1 key
                                                                            • ▶
                                                                              {} 1 key
                                                                              • ▶
                                                                                {} 3 keys
                                                                                • ▶
                                                                                  {} 3 keys
                                                                                • false

                                                                              Resource Job Patch Example​

                                                                              • ▶
                                                                                {} 2 keys
                                                                                • "Example Resource Job"
                                                                                • "{ "name": "my device"}"

                                                                              Success​

                                                                              Schema for reporting a successful operation

                                                                              Success Schema​

                                                                              • ▶
                                                                                {} 3 keys
                                                                                • "http://json-schema.org/draft-07/schema#"
                                                                                • "object"
                                                                                • ▶
                                                                                  {} 1 key
                                                                                  • ▶
                                                                                    {} 2 keys

                                                                                Success Example​

                                                                                • ▶
                                                                                  {} 1 key
                                                                                  • true

                                                                                Success With Execution ID​

                                                                                Schema for reporting a successful operation with a corresponding execution ID

                                                                                Success With Execution ID Schema​

                                                                                • ▶
                                                                                  {} 3 keys
                                                                                  • "http://json-schema.org/draft-07/schema#"
                                                                                  • "object"
                                                                                  • ▶
                                                                                    {} 2 keys
                                                                                    • ▶
                                                                                      {} 2 keys
                                                                                      • ▶
                                                                                        {} 2 keys

                                                                                    Success With Execution ID Example​

                                                                                    • ▶
                                                                                      {} 2 keys
                                                                                      • true
                                                                                      • "575ed78e7ae143cd83dc4aab"

                                                                                    Was this page helpful?


                                                                                    Still looking for help? You can also search the WEGnology Forums or submit your question there.