APEX Job Management APIs – Get Job Instances
Wed, 14 Feb 2024 07:41:41 -0000
|Read Time: 0 minutes
In this blog we will cover two REST APIs from APEX Job Management System for querying jobs.
Before you begin:
1. APEX API access key and secret has been generated and is available. You can check “Creating & Managing Dell APEX API access key Id and secret” blog addressing how to create an APEX API access key & secret.
2. You have a Dell Identity (DI) token. You can check “Requesting Dell Identity JSON web token” blog for steps on requesting a DI token.
Collection query:
The section below describes how we can query APEX Jobs with multiple query parameters. The following are query parameters supported by the API,
Limit à Number of items to be returned.
Offset à Zero based index of the first item in the result page.
Oder à Ascending or Descending
Filter à Query API supports following filters,
Job name
Job Status
Service
Time (Created, Started and Finished)
Example of filter:
(state in (RUNNING,FAILED)) and (name like "provision") and (name eq "some service")
URL:
Endpoint:
/rest/v1/jobs
Example:
curl --location "https://apex.apis.dell.com/apex/rest/v1/jobs/?order=timeCreated.dsc&limit=5&offSet=0&filter=(state in (RUNNING,FAILED)) --header "Accept: application/json" --header "Authorization: Bearer {DI Token}" --header "Content-Type: application/json"
Replace {DI_Token} with DI token.
The response will be something like this:
{
"paging" : {
"total_instances" : 1161,
"first" : "/rest/v1/jobs?limit=5&order=timeCreated.dsc&offset=0",
"last" : "/rest/v1/jobs?limit=5&order=timeCreated.dsc&offset=232",
"next" : "/rest/v1/jobs?limit=5&order=timeCreated.dsc&offset=1",
"prev" : null
},
"results" : [
{
"id" : "123456789",
"name" : "My Job",
"state" : "SUCCEEDED",
"create_time" : "2024-01-30T23:38:52.475+00:00",
"start_time" : "2024-01-30T23:38:52.475+00:00",
"end_time" : "2024-01-30T23:41:45.087+00:00",
"progress" : 0,
.........
},
......
]
}
Instance query
The section below describes how we can query APEX Job details for a particular job.
URL:
Endpoint:
/rest/v1/jobs/{id}
Example:
curl --location "https://apex.apis.dell.com/apex/rest/v1/jobs/{Job_Id} --header "Accept: application/json" --header "Authorization: Bearer {DI_Token}" --header "Content-Type: application/json"
Replace {DI_Token} with a DI token, and {Job_Id} with a job id.
Response will be something like,
{
"id" : "123456789",
"name" : "My job",
"state" : "SUCCEEDED",
"create_time" : "2024-01-30T23:38:52.475+00:00",
"start_time" : "2024-01-30T23:38:52.475+00:00",
"end_time" : "2024-01-30T23:41:45.087+00:00",
"progress" : 0,
.........
}
Authors:
Ratnesh Yadav,
www.linkedin.com/in/ratneshyadavpublic
Roopa Avula
https://www.linkedin.com/in/roopa-avula