Getting job session information¶
You can get information about job sessions. IBM Spectrum Protet Plus assigns a {jobsessionId}
for every job and stores the information about the job. The information includes the type of job, the start time, the end time, and the job status: RUNNING
, PARTIAL
, COMPLETED
, and so on.
Method and URI¶
To get information about job sessions, use a GET method and a URI:
GET https://{hostname|IPv4}/api/endeavour/jobsession
To get information about a specific job session, use a GET method and a URI:
GET https://{hostname|IPv4}/api/endeavour/jobsession/{jobsessionId}
You can get the {jobsessionId}
of the specific job session from the list of all job sessions.
Parameters¶
Parameter 1: pageStartIndex
By default, the REST API splits the response body every 100 records. To see the next 100 records, use this parameter to see the other 100 records from the given index value. Index values are assigned to all records, starting with zero. Therefore, to see the 101st through the 200th records, use 100
for the pageStartIndex value.
Value Example:
100
Type: String. Available in the web user interface.
Parameter 2: filter
Filter the results by specifying criteria.
Example value: Use the following value to get results that has the all status types:
[
{
"property": "status",
"value": [
"RUNNING", "PENDING", "HELD", "WAITING", "PAUSING", "PAUSED",
"STOPPING", "STOPPED", "CANCELING", "CANCELED", "SUSPENDING",
"SUSPENDED", "FAILED", "PARTIAL", "COMPLETED", "UNKNOWN"
],
"op": "IN"
}
]
Type: List. Available in the web user interface.
Parameter 3: sort
By default, job session records are sorted by the start time, in ascending order, from the oldest record to the latest record. Use this parameter to sort the job session records in descending order.
Value:
[
{
"property": "start",
"direction": "DESC"
}
]
Type: Array. Available in the web user interface.
Data¶
None.
Example 1: Get information about all job sessions¶
Assume that you want to get a list of all job session records. Also assume that you want to sort job session records by the start time, in descending order, so that the latest jobs are at the top of the results.
The following Python snippet requests a list of all job session records and sorts them by start time in descending order:
_params = (
('sort', '[\
{\
"property": "start",\
"direction":"DESC"\
}\
]'),
)
requests.get('https://' + spp_ipv4 + '/api/endeavour/jobsession',
headers={...}, params=_params, verify=...)
The request prompts a response that is structured as shown, with the HTTP status of 200 (OK).
{
"links": {...},
"total": 4877,
"page": 1,
"sessions": [
{
"links": {...},
"jobName": "Application Server Inventory",
"jobId": "1003",
"type": "catalog",
"typeDisplayName": "Catalog",
"subType": "application",
"subTypeDisplayName": "Application",
"subPolicyType": null,
"subPolicyTypeDisplayName": null,
"serviceId": "serviceprovider.catalog.application",
"displayName": null,
"start": 1577881234,
"end": 1577882234123,
"duration": 1000000,
"status": "PARTIAL",
"statusDisplayName": "Partial",
"indexStatus": "COMPLETED",
"description": "Autorun - 10.4.4.1 only",
"results": "Started",
"properties": null,
"numTasks": 2,
"previousLastTask": 0,
"lastUpdate": 1577882235123,
"percent": 0,
"expiresAt": null,
"expirationTime": null,
"retention": 0,
"retentionUnit": null,
"expired": false,
"hasCatalog": false,
"hasCondensed": false,
"wormProtected": false,
"rerunnable": false,
"userUpdate": false,
"actions": [],
"statistics": null,
"policySnapshot": {
"id": "1003",
"name": "Application Server Inventory",
"type": "catalog",
"subType": "application",
"serviceId": "serviceprovider.catalog.application",
"version": null,
"spec": {
"source": [
{
"href": "http://localhost:8082/api/appserver/1001",
"resourceType": "appserver",
"name": "10.4.4.1",
"id": "1001",
"include": true,
"metadata": {
"path": ":",
"name": "10.4.4.1"
}
}
],
"option": {
"retention": "3",
"maxtasks": 50
},
"notification": [],
"applicationtype": "oracle"
},
"description": "",
"script": null
},
"id": "1564688656142"
},
{...}, ..., {...}
]
}
The first job session record in the response body contains information that includes the following items:
Job name: Application Server Inventory
Start time: 1577881234123 (1 January 2020 at 6:20:34:123 AM US-CST)
End time: 1577882234123 (1 January 2020 at 6:37:14:123 AM US-CST)
Duration: 1,000,000 milliseconds (16 minutes and 40 seconds)
Status: Partial
{jobsessionId}
: 1564688656142
The total
value in the response indicates that there are 4,877 job session records. By default, the REST API splits the response body every 100 records. The response contains only the first 100 job session records. To see the next 100 records, use the following Python snippet:
_params = {
"pageStartIndex": 100
}
requests.get('https://' + spp_ipv4 + '/api/endeavour/jobsession',
headers={...}, params=_params, verify=...)
The request prompts a response that is structured as shown, with the HTTP status of 200. As you see in the response body below, the page number increased to 2.
{
"links": {...},
"total": 4877,
"page": 2,
"sessions": [{...}, ..., {...}]
}
To see page 3 for the records of the 201st through the 300th, increase the pageStartIndex
value to 200.
Example 2: Get information about a specific job session¶
Assume that you want to track one of the job sessions, and you have the {jobsessionId}
: 1564688656142.
A Python snippet that is similar to the following example can be used to request the information about this job session:
jobsession_id = "1564688656142"
requests.get('https://' + spp_ipv4 + '/api/endeavour/jobsession/'
+ jobsession_id,
headers={...}, verify=...)
You will get the job session record, with the HTTP status of 200 (OK).
Example 3: Get information about job sessions that are running¶
Assume that you want to get information about job sessions that are running or that will run shortly. In this case, you have to use the filter
parameter to select only the job sessions that have the status value of RUNNING
, PENDING
, HELD
, or CANCELING
.
A Python snippet that is similar to the following example can be used to provide the filtered information:
_params = (
('sort', '[\
{\
"property": "start",\
"direction": "DESC"\
}\
]'),
('filter', '[\
{\
"property": "status",\
"value": ["RUNNING", "PENDING", "HELD", "CANCELING"],\
"op": "IN"\
}\
]'),
)
requests.get('https://' + spp_ipv4 + '/api/endeavour/jobsession',
headers={...}, params=_params, verify=...)

Figure 4 The same action can be taken in the IBM Spectrum Protect Plus web user interface: In the navigation pane, click Jobs and Operations and ensure that the Running Jobs tab is displayed.¶
The request prompts a response that is similar to the response body in Example 1, with the HTTP status of 200 (OK). All of the job session records have the status value of RUNING
, PENDING
, HELD
, or CANCELING
.