Share via


Read (GET) Runbooks

Read using the HTTP GET operation.

Code Examples

Request

Method Request URI HTTP Version

GET

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

GET https://sma-server:9090/00000000-0000-0000-0000-000000000000/Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90') 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/Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')</id>
  <category term="Orchestrator.ResourceModel.Runbook" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <link rel="edit" title="Runbook" href="Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')" />
  <link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/Statistics" type="application/atom+xml;type=entry" title="Statistics" href="Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/Statistics" />
  <link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/DraftRunbookVersion" type="application/atom+xml;type=entry" title="DraftRunbookVersion" href="Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/DraftRunbookVersion" />
  <link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/PublishedRunbookVersion" type="application/atom+xml;type=entry" title="PublishedRunbookVersion" href="Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/PublishedRunbookVersion" />
  <link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/Schedules" type="application/atom+xml;type=feed" title="Schedules" href="Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/Schedules" />
  <title />
  <updated>2014-04-02T17:04:01Z</updated>
  <author>
    <name />
  </author>
  <m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.Start" title="Start" target="https://sma-server:9090/00000000-0000-0000-0000-000000000000/Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/Start" />
  <m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.StartOnSchedule" title="StartOnSchedule" target="https://sma-server:9090/00000000-0000-0000-0000-000000000000/Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/StartOnSchedule" />
  <m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.GetStatistics" title="GetStatistics" target="https://sma-server:9090/00000000-0000-0000-0000-000000000000/Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/GetStatistics" />
  <m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.Edit" title="Edit" target="https://sma-server:9090/00000000-0000-0000-0000-000000000000/Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/Edit" />
  <m:action metadata="https://sma-server:9090/00000000-0000-0000-0000-000000000000/$metadata#OrchestratorApi.Test" title="Test" target="https://sma-server:9090/00000000-0000-0000-0000-000000000000/Runbooks(guid'ec1c8f52-c5d4-4acc-a42b-19a55764ae90')/Test" />
  <content type="application/xml">
    <m:properties>
      <d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
      <d:RunbookID m:type="Edm.Guid">ec1c8f52-c5d4-4acc-a42b-19a55764ae90</d:RunbookID>
      <d:RunbookName>Sample-Deleting-VMCloud-Subscription</d:RunbookName>
      <d:CreationTime m:type="Edm.DateTime">2014-02-07T18:30:51.343</d:CreationTime>
      <d:LastModifiedTime m:type="Edm.DateTime">2014-02-07T18:30:51.827</d:LastModifiedTime>
      <d:LastModifiedBy m:null="true" />
      <d:Description m:null="true" />
      <d:IsApiOnly m:type="Edm.Boolean">false</d:IsApiOnly>
      <d:IsGlobal m:type="Edm.Boolean">false</d:IsGlobal>
      <d:PublishedRunbookVersionID m:type="Edm.Guid">1ecd0605-fb1e-4019-9b00-6553c06b016f</d:PublishedRunbookVersionID>
      <d:DraftRunbookVersionID m:type="Edm.Guid" m:null="true" />
      <d:Tags m:null="true" />
      <d:LogDebug m:type="Edm.Boolean">false</d:LogDebug>
      <d:LogVerbose m:type="Edm.Boolean">false</d:LogVerbose>
      <d:LogProgress m:type="Edm.Boolean">false</d:LogProgress>
    </m:properties>
  </content>
</entry>

Code Examples

The following example searches for a specific Runbook, identified by the RunbookID (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 runbook instance to search for.
                var runbookID = new Guid("ec1c8f52-c5d4-4acc-a42b-19a55764ae90");

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

                // Output select properties of the instance to the console.
                Console.WriteLine("Found Runbook ID                   : {0}", runbook.RunbookID);
                Console.WriteLine("Found Runbook Name                 : {0}", runbook.RunbookName);
                Console.WriteLine("Found Runbook Published Version    : {0}", runbook.PublishedRunbookVersion);
                Console.WriteLine("Found Runbook Published Version ID : {0}", runbook.PublishedRunbookVersionID);
                Console.ReadKey();
            }
            catch (NullReferenceException ex)
            {
                throw new ApplicationException("An error occurred during execution.", ex);
            }
        }                 
    }
}

See Also

Concepts

Runbook
Runbooks