Read (GET) Jobs
Read using the HTTP GET operation.
Code Examples
Request
Method | Request URI | HTTP Version |
---|---|---|
GET |
HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Jobs(guid'<GUID>') |
HTTP/1.1 |
Request URI Parameters
URI Parameter | Description |
---|---|
GUID |
Required. The unique identifier value (JobID) for a Job entity. |
Request URI Example
Example URI |
---|
GET https://sma-server:9090/00000000-0000-0000-0000-000000000000/Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0') HTTP/1.1 |
Request Headers
For more information about the common request headers used by this operation, see Standard Service Management Automation POST/GET/PUT/DELETE Headers.
Request Body
The GET operation has no request body.
Response
Response Codes
Response Code | Description |
---|---|
HTTP/1.1 200 OK |
Successful HTTP request. |
Response Headers
For more information about the common response headers used by this operation, see Standard Service Management Automation POST/GET/PUT/DELETE Headers.
Response Body
<?xml version="1.0" encoding="utf-8"?><entry xml:base="https://sma-server:9090/00000000-0000-0000-0000-000000000000/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="https://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="https://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<id>https://sma-server:9090/00000000-0000-0000-0000-000000000000/Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')</id>
<category term="Orchestrator.ResourceModel.Job" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Job" href="Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/JobContext" type="application/atom+xml;type=entry" title="JobContext" href="Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')/JobContext" />
<title />
<updated>2014-04-03T16:23:35Z</updated>
<author>
<name />
</author>
<m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.Resume" title="Resume" target="https://waplabvm4:9090/00000000-0000-0000-0000-000000000000/Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')/Resume" />
<m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.Stop" title="Stop" target="https://waplabvm4:9090/00000000-0000-0000-0000-000000000000/Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')/Stop" />
<m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.Suspend" title="Suspend" target="https://waplabvm4:9090/00000000-0000-0000-0000-000000000000/Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')/Suspend" />
<link rel="edit-media" title="Job" href="Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')/$value" />
<content type="application/octet-stream" src="Jobs(guid'08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0')/$value" />
<m:properties>
<d:JobID m:type="Edm.Guid">08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0</d:JobID>
<d:JobContextID m:type="Edm.Guid">e812721a-2142-4d69-81ae-430c40f0bff9</d:JobContextID>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
<d:JobStatus>Completed</d:JobStatus>
<d:StartTime m:type="Edm.DateTime">2014-04-01T17:44:28.037</d:StartTime>
<d:EndTime m:type="Edm.DateTime">2014-04-01T17:44:28.377</d:EndTime>
<d:CreationTime m:type="Edm.DateTime">2014-04-01T17:44:17.857</d:CreationTime>
<d:LastModifiedTime m:type="Edm.DateTime">2014-04-01T17:44:28.377</d:LastModifiedTime>
<d:ErrorCount m:type="Edm.Int16">0</d:ErrorCount>
<d:WarningCount m:type="Edm.Int16">0</d:WarningCount>
<d:JobException m:null="true" />
</m:properties>
</entry>
Code Examples
The following example searches for a specific Job, identified by the JobID (a unique guid value).
namespace CodeSample.Microsoft.SystemCenter.SMA
{
public class SMASamples
{
public static void Main()
{
// Replace this with the name of your SMA web service endpoint.
string serviceEndPoint = "https://sma-server:9090/00000000-0000-0000-0000-000000000000";
// Setup the connection to SMA.
OrchestratorApi SMAService = new OrchestratorApi(new Uri(serviceEndPoint));
// Set credentials to the default or to a specific user.
((DataServiceContext)SMAService).Credentials = CredentialCache.DefaultCredentials;
//((DataServiceContext)SMAService).Credentials = new NetworkCredential("user", "pwd", "domain");
try
{
// Identify a specific job instance to search for.
var jobID = new Guid("08c39c5e-1067-4fc4-8e9c-0a04bf5f28a0");
// Query for the specific job instance identified by JobID.
var job = SMAService.Jobs.Where(r => r.JobID == jobID).FirstOrDefault();
// Output select properties of the instance to the console.
Console.WriteLine("Found Job ID : {0}", job.JobID);
Console.WriteLine("Found Start Time : {0}", job.StartTime);
Console.WriteLine("Found Job Status : {0}", job.JobStatus);
Console.ReadKey();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex);
}
}
}
}