Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Update using the HTTP POST operation.
Code Examples
Request
| Method | Request URI | HTTP Version |
|---|---|---|
POST |
HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Schedules |
HTTP/1.1 |
Request URI Parameters
The POST operation has no parameters.
Request URI Example
| Example URI |
|---|
POST https://sma-server:9090/00000000-0000-0000-0000-000000000000/Schedules 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 POST request body.
<?xml version="1.0" encoding="utf-8"?><entry 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">
<category term="Orchestrator.ResourceModel.DailySchedule" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<id />
<title />
<updated>2014-04-02T21:39:07Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:CreationTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:CreationTime>
<d:DayInterval m:type="Edm.Byte">1</d:DayInterval>
<d:Description>Test - Daily Schedule</d:Description>
<d:ExpiryTime m:type="Edm.DateTime" m:null="true" />
<d:IsEnabled m:type="Edm.Boolean">false</d:IsEnabled>
<d:LastModifiedTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:LastModifiedTime>
<d:Name>Daily Schedule Test</d:Name>
<d:NextRun m:type="Edm.DateTime" m:null="true" />
<d:ScheduleID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:ScheduleID>
<d:StartTime m:type="Edm.DateTime">2014-04-02T21:39:06.9191596Z</d:StartTime>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
</m:properties>
</content>
</entry>
Response
Response Codes
| Response Code | Description |
|---|---|
HTTP/1.1 201 Created |
Request fulfilled. |
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
The POST 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'307670d9-4919-4b56-b409-7b61e17ca35c')</id>
<category term="Orchestrator.ResourceModel.DailySchedule" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Schedule" href="Schedules(guid'307670d9-4919-4b56-b409-7b61e17ca35c')" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/JobContexts" type="application/atom+xml;type=feed" title="JobContexts" href="Schedules(guid'307670d9-4919-4b56-b409-7b61e17ca35c')/JobContexts" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/Runbooks" type="application/atom+xml;type=feed" title="Runbooks" href="Schedules(guid'307670d9-4919-4b56-b409-7b61e17ca35c')/Runbooks" />
<title />
<updated>2014-04-02T21:39:08Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:ScheduleID m:type="Edm.Guid">307670d9-4919-4b56-b409-7b61e17ca35c</d:ScheduleID>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
<d:Name>Daily Schedule Test</d:Name>
<d:Description>Test - Daily Schedule</d:Description>
<d:StartTime m:type="Edm.DateTime">2014-04-02T21:39:00</d:StartTime>
<d:ExpiryTime m:type="Edm.DateTime">9999-12-31T23:59:59.9999999Z</d:ExpiryTime>
<d:CreationTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:CreationTime>
<d:LastModifiedTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:LastModifiedTime>
<d:IsEnabled m:type="Edm.Boolean">false</d:IsEnabled>
<d:NextRun m:type="Edm.DateTime" m:null="true" />
<d:DayInterval m:type="Edm.Byte">1</d:DayInterval>
</m:properties>
</content>
</entry>
Code Examples
The following example creates a new DailySchedule or OneTimeSchedule.
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
{
// Create a new schedule instance.
// Instantiate DailySchedule or OneTimeSchedule (both inherit from the base class Schedule).
var testSchedule = new DailySchedule();
testSchedule.Name = "Daily Schedule Test";
testSchedule.StartTime = DateTime.UtcNow;
testSchedule.DayInterval = 1;
testSchedule.Description = "Test - Daily Schedule";
// Create a new schedule instance.
// Instantiate DailySchedule or OneTimeSchedule (both inherit from the base class Schedule).
//var testSchedule = new OneTimeSchedule();
//testSchedule.Name = "One Time Schedule Test";
//testSchedule.StartTime = DateTime.UtcNow;
//testSchedule.Description = "Test - One Time Schedule";
// Add the new schedule instance to the Schedules collection.
// Note: This action is queued up until the SaveChanges action is called.
SMAService.AddToSchedules(testSchedule);
// Save all pending actions (client -> server communication initiated).
SMAService.SaveChanges();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex.InnerException);
}
}
}
}