Get Job History

 

The Get Job History operation gets the history details of specified job from the specified job collection.

Request

The Get Job History request is specified as follows. Replace <subscription-id> with your subscription ID, <cloud-service-id> with your cloud service ID, <job-collection-id> with the ID of the job collection, and <job-id> with the ID of the job. When Scheduler jobs execute, they record a log of their results. The response is a JSON array of history objects.

Method

Request URI

GET

https://management.core.windows.net/<subscription-id>/cloudservices/<cloud-service-id>/resources/scheduler/~/jobCollections/<job-collection-id>/jobs/<job-id>/history?api-version=2014-04-01

URI Parameters

Parameter

Description

state

Optional. To fetch all records of a particular state, you can provide a query parameter defining the state you are interested in (e.g. enabled, disabled, completed, faulted). For example, to retrieve all job records that are completed, you would call GET /history?$filter=state%20eq%20completed

status

Optional. To fetch all records of a particular status, you can provide a query parameter defining the jobs you are interested in (e.g. failed, completed). For example, to retrieve all job records that are failed, you would call GET /history?$filter=status%20eq%20failed

top

Optional. This fetches the top N job records, where N is the argument specified as the value, like so: GET /history?$top=10. This may be combined with the other parameters, like so: GET /history?$top=10&filter=status%20eq%20failed.

skip

Optional. This skips the top N job records and returns the remaining results as specified, where N is the argument specified as the value, like so: GET /history?$skip=10. This may be combined with the other parameters, like so: GET /history?$top=5&$skip=10$filter=status%20eq%20failed.

Request Headers

The following table describes required and optional request headers.

Request Header

Description

x-ms-version

Required. Specifies the version of the operation to use for this request. This header should be set to 2013-06-01 or a later version.

Request Body

None.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

A successful operation returns status code 200 (OK).

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header

Description

x-ms-request-id

A value that uniquely identifies a request made against the Management service. For an asynchronous operation, you can call get operation status with the value of the header to determine whether the operation is complete, has failed, or is still in progress. See Tracking Asynchronous Service Management Requests for more information.

Response Body

The format of the response body is as follows:

[
  {
    "jobId": "job1", 
    "timestamp": "2012-05-01T18:56:46", 
    "startTime": "2013-08-30T20:55:02.4143712Z",
    "endTime": "2013-08-30T20:55:02.5706248Z",
    "state": "enabled",
    "message": "Job Created"
  },
  {
    "jobId": "job1", 
    "timestamp": "2012-06-01T18:56:46", 
    "startTime": "2013-09-30T20:55:02.4143712Z",
    "endTime": "2013-09-30T20:55:02.5706248Z",
    "state": "enabled",
    "message": "Http Action - Response from host 'www.bing.com': 'OK' Body: "
  }
]

Below are key elements of this response body

Response Property

Description

timestamp

The historical timestamp when the job was executed

Message

Specifies the action that was taken

startTime

Start time of the execution of the job

endTime

End time of the execution of the job

Status

The Status property’s values will be either failed or completed

ActionName

The ActionName property values will be either mainAction or errorAction

State 

The state of the job at the end of execution

Authorization

Any management certificate associated with the subscription specified by <Subscription-Id> can be used to authenticate this operation. For additional details, see Authenticating Service Management Requests

Sample Request and Response

The following sample URI makes a request for fictional subscription named mysub and fictional cloud service mycs:

GET https://management.core.windows.net/{subid}/cloudservices/CS1/resources/scheduler/~/jobcollections/myjc/jobs/job1/history?api-version=2014-04-01

The request is sent with the following headers:

x-ms-version: 2013-06-01
Host: management.core.windows.net

The request is sent with the following XML body:

(Empty)

After the request has been sent, the following response is returned:

// Response
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 2424
Content-Type: application/json; charset=utf-8
Expires: -1
X-Powered-By: ASP.NET
x-ms-request-id: 58b481e746124941b5148d32b620df7b
Date: Fri, 30 Aug 2013 20:57:02 GMT

[
  {
    "jobId": "job1",
    "timestamp": "2013-08-30T20:55:02.4143712Z",
    "startTime": "2013-08-30T20:55:02.4143712Z",
    "endTime": "2013-08-30T20:55:02.5706248Z",
    "state": "enabled",
    "message": "Response from 'http:\/\/bing.com\/': OK <!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\"><html lang=\"en\" xml:lang=\"en\" xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><head><meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/>\u2026}"
  }
]


See Also

What is Scheduler?
Get Started Using Scheduler in the Management Portal
Scheduler Concepts, Terminology, and Entity Hierarchy
How to Build Complex Schedules and Advanced Recurrence with Azure Scheduler
Scheduler PowerShell Cmdlets Reference
Scheduler High-Availability and Reliability
Scheduler Outbound Authentication
Scheduler Limits, Defaults, and Error Codes
Plans and Billing in Azure Scheduler
Azure Scheduler Pricing
Azure Scheduler Videos
Register Subscription
Get Resource Provider Properties
Create Cloud Service2
Get Cloud Service1
Get Cloud Services2
Delete Cloud Service2
Create Job1
Update Job1
Get Job1
Delete Job2
Check Name Availability1
Create Job Collection
Update Job Collection
Get Job Collection
Delete Job Collection
Get All Jobs
Get Job History (Scheduler API)