Read (GET) Schedules
Read using the HTTP GET operation.
Code Examples
Request
Method | Request URI | HTTP Version |
---|---|---|
GET |
HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Schedules(guid'<GUID>') |
HTTP/1.1 |
Request URI Parameters
URI Parameter | Description |
---|---|
GUID |
Required. The unique identifier value (ScheduleID) for a Schedule entity. |
Request URI Example
Example URI |
---|
GET https://sma-server:9090/00000000-0000-0000-0000-000000000000/Schedules(guid'36acbbcd-311e-4229-9343-45e87ace4fd5') 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/Schedules(guid'36acbbcd-311e-4229-9343-45e87ace4fd5')</id>
<category term="Orchestrator.ResourceModel.OneTimeSchedule" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Schedule" href="Schedules(guid'36acbbcd-311e-4229-9343-45e87ace4fd5')" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/JobContexts" type="application/atom+xml;type=feed" title="JobContexts" href="Schedules(guid'36acbbcd-311e-4229-9343-45e87ace4fd5')/JobContexts" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/Runbooks" type="application/atom+xml;type=feed" title="Runbooks" href="Schedules(guid'36acbbcd-311e-4229-9343-45e87ace4fd5')/Runbooks" />
<title />
<updated>2014-04-01T19:13:43Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:ScheduleID m:type="Edm.Guid">36acbbcd-311e-4229-9343-45e87ace4fd5</d:ScheduleID>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
<d:Name>Test Schedule</d:Name>
<d:Description>Test Schedule</d:Description>
<d:StartTime m:type="Edm.DateTime">2014-03-24T18:00:00</d:StartTime>
<d:ExpiryTime m:type="Edm.DateTime">2014-03-24T18:00:00</d:ExpiryTime>
<d:CreationTime m:type="Edm.DateTime">2014-03-24T17:27:19.5</d:CreationTime>
<d:LastModifiedTime m:type="Edm.DateTime">2014-03-24T17:27:19.5</d:LastModifiedTime>
<d:IsEnabled m:type="Edm.Boolean">true</d:IsEnabled>
<d:NextRun m:type="Edm.DateTime" m:null="true" />
</m:properties>
</content>
</entry>
Code Examples
The following example searches for a specific Schedule, identified by the ScheduleID (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 schedule instance to search for.
var scheduleID = new Guid("36acbbcd-311e-4229-9343-45e87ace4fd5");
// Query for the specific schedule identified by ScheduleID.
var schedule = SMAService.Schedules.Where(r => r.ScheduleID == scheduleID).FirstOrDefault();
// Output select properties of the instance to the console.
Console.WriteLine("Found Schedule ID : {0}", schedule.ScheduleID);
Console.WriteLine("Found Schedule Name : {0}", schedule.Name);
Console.WriteLine("Found Schedule Start Time : {0}", schedule.StartTime);
Console.ReadKey();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex);
}
}
}
}