Share via


Read (GET) Deployments

Read using the HTTP GET operation.

Code Examples

Request

Method Request URI HTTP Version

GET

HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Deployments(guid’<GUID>’)

HTTP/1.1

Request URI Parameters

This example requires no parameters (it is an enumeration of the complete collection).

Request URI Example

Example URI

GET https://waplabvm4:9090/00000000-0000-0000-0000-000000000000/Deployment 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"?><feed 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/Deployment/</id>
  <title type="text">Deployment</title>
  <updated>2014-03-31T22:18:09Z</updated>
  <link rel="self" title="Deployment" href="Deployment" />
  <entry>
    <id>https://sma-server:9090/00000000-0000-0000-0000-000000000000/Deployment(0)</id>
    <category term="Orchestrator.ResourceModel.Deployment" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="Deployment" href="Deployment(0)" />
    <title />
    <updated>2014-03-31T22:18:09Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:InstanceId m:type="Edm.Int32">0</d:InstanceId>
        <d:ComputerName>SMA-SERVER</d:ComputerName>
        <d:LookupName m:null="true" />
        <d:LowKey m:type="Edm.Int32">0</d:LowKey>
        <d:HighKey m:type="Edm.Int32">2147483647</d:HighKey>
        <d:CreationTime m:type="Edm.DateTime">2014-02-07T18:32:10.537</d:CreationTime>
        <d:LastModifiedTime m:type="Edm.DateTime">2014-02-07T18:32:10.537</d:LastModifiedTime>
      </m:properties>
    </content>
  </entry>
</feed>

Code Examples

The following example searches for all Deployment instances.

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
            {
                // Query for all deployment instances.
                var deployments = SMAService.Deployment;
               
                // Loop through the result set.
                foreach (var deployment in deployments)
                {
                    // Output select properties of the instance to the console.
                    Console.WriteLine("Found Instance ID  : {0}", deployment.InstanceId);
                    Console.WriteLine("Found Computer Name: {0}", deployment.ComputerName);
                }
                Console.ReadKey();
 
            }
            catch (Exception ex)
            {
                throw new ApplicationException("An error occurred during execution.", ex);
            }
        }                 
    }
}

See Also

Concepts

Deployment
Deployment