Update (PUT/MERGE) Schedules
Update using the HTTP PUT/MERGE operation.
Code Examples
Request
Method | Request URI | HTTP Version |
---|---|---|
MERGE |
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 |
---|
MERGE 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 PUT/MERGE 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">
<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" />
<title />
<updated>2014-04-01T21:25:09Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:CreationTime m:type="Edm.DateTime">2014-03-24T17:27:19.5</d:CreationTime>
<d:Description>Updated Description.</d:Description>
<d:ExpiryTime m:type="Edm.DateTime">2014-03-24T18:00:00</d:ExpiryTime>
<d:IsEnabled m:type="Edm.Boolean">true</d:IsEnabled>
<d:LastModifiedTime m:type="Edm.DateTime">2014-04-01T21:20:31.987</d:LastModifiedTime>
<d:Name>Test Schedule</d:Name>
<d:NextRun m:type="Edm.DateTime" m:null="true" />
<d:ScheduleID m:type="Edm.Guid">36acbbcd-311e-4229-9343-45e87ace4fd5</d:ScheduleID>
<d:StartTime m:type="Edm.DateTime">2014-03-24T18:00:00</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 204 No Content |
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 PUT/MERGE operation has no response body.
Code Examples
The following example searches for a specific Schedule, identified by the ScheduleID (a unique guid), and updates the Description 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.
System.Guid scheduleID = new Guid("36acbbcd-311e-4229-9343-45e87ace4fd5");
// Query for the specific schedule instance identified by ScheduleID.
var schedule = SMAService.Schedules.Where(r => r.ScheduleID == scheduleID).FirstOrDefault();
// Modify the schedule instance description property.
// NOTE: Other schedule properties can’t be modified.
schedule.Description = "Updated Description.";
// Update the variable object.
// Note: This action is queued up until the SaveChanges action is called.
SMAService.UpdateObject(schedule);
// Save all pending actions (client -> server communication initiated).
SMAService.SaveChanges();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex);
}
}
}
}