Share via


Update (PUT/MERGE) Runbooks

Update using the HTTP PUT/MERGE operation.

Code Examples

Request

Method Request URI HTTP Version

MERGE

HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Runbooks(guid'<GUID>')

HTTP/1.1

Request URI Parameters

URI Parameter Description

GUID

Required. The unique identifier value (RunbookID) for a Runbook entity.

Request URI Example

Example URI

MERGE https://sma-server:9090/00000000-0000-0000-0000-000000000000/Runbooks(guid'7a27a757-7ff8-4f93-9b49-3174b2b8ce77') 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/Runbooks(guid'7a27a757-7ff8-4f93-9b49-3174b2b8ce77')</id>
  <category term="Orchestrator.ResourceModel.Runbook" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <title />
  <updated>2014-04-05T23:33:06Z</updated>
  <author>
    <name />
  </author>
  <content type="application/xml">
    <m:properties>
      <d:CreationTime m:type="Edm.DateTime">2014-02-07T18:30:50.087</d:CreationTime>
      <d:Description>Modified Description</d:Description>
      <d:DraftRunbookVersionID m:type="Edm.Guid" m:null="true" />
      <d:IsApiOnly m:type="Edm.Boolean">false</d:IsApiOnly>
      <d:IsGlobal m:type="Edm.Boolean">false</d:IsGlobal>
      <d:LastModifiedBy m:null="true" />
      <d:LastModifiedTime m:type="Edm.DateTime">2014-02-07T18:30:50.253</d:LastModifiedTime>
      <d:LogDebug m:type="Edm.Boolean">false</d:LogDebug>
      <d:LogProgress m:type="Edm.Boolean">false</d:LogProgress>
      <d:LogVerbose m:type="Edm.Boolean">false</d:LogVerbose>
      <d:PublishedRunbookVersionID m:type="Edm.Guid">7db8797c-c7fc-4fd1-b247-320585002719</d:PublishedRunbookVersionID>
      <d:RunbookID m:type="Edm.Guid">7a27a757-7ff8-4f93-9b49-3174b2b8ce77</d:RunbookID>
      <d:RunbookName>SetAutomationModuleActivityMetadata</d:RunbookName>
      <d:Tags>SystemRunbook</d:Tags>
      <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 Runbook, identified by the RunbookID (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 runbook instance to search for.
                System.Guid runbookID = new Guid("7a27a757-7ff8-4f93-9b49-3174b2b8ce77");

                // Query for the specific runbook instance identified by RunbookID.
                var runbook = SMAService.Runbooks.Where(r => r.RunbookID == runbookID).FirstOrDefault();

                // Modify a runbook instance property.
                runbook.Description = "Modified Description";
                
                // Update the runbook object.
                // Note: This action is queued up until the SaveChanges action is called.
                SMAService.UpdateObject(runbook);

                // Save all pending actions (client -> server communication initiated).
                SMAService.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new ApplicationException("An error occurred during execution.", ex);
            }
        }                 
    }
}

See Also

Concepts

Runbook
Runbooks