Compartilhar via


Read (GET) Certificates

Read using the HTTP GET operation.

Code Examples

Request

Method Request URI HTTP Version

GET

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

HTTP/1.1

Request URI Parameters

URI Parameter Description

GUID

Required. The unique identifier value (CertificateID) for a Certificate entity.

Request URI Example

Example URI

GET https://sma-service:9090/00000000-0000-0000-0000-000000000000/Certificates(guid'50ed1abe-1487-463a-b9b1-7bea435413b2') 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/Certificates(guid'50ed1abe-1487-463a-b9b1-7bea435413b2')</id>
  <category term="Orchestrator.ResourceModel.Certificate" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <link rel="edit" title="Certificate" href="Certificates(guid'50ed1abe-1487-463a-b9b1-7bea435413b2')" />
  <title />
  <updated>2014-04-06T22:24:59Z</updated>
  <author>
    <name />
  </author>
  <content type="application/xml">
    <m:properties>
      <d:CertificateID m:type="Edm.Guid">50ed1abe-1487-463a-b9b1-7bea435413b2</d:CertificateID>
      <d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
      <d:Name>TEST CERTIFICATE</d:Name>
      <d:RawValue m:null="true" />
      <d:Value>MsaVHj0uWRV6bLGpBl8lraF5JzTzSalI9F0rAwIJqt/6yNgRZ2cciHxlkA0aGC0+V3fiXu+no/Ts5DJnxjAY6SWaivjXmqViSc8I/BYNwi3l5qjeEp0F7izsNfDj4okr+r2Yp3joOltW78Zpz9z3FYr5DFSLe03keeOy0CeyP2rAJx/Cj6R+opiyGOVjfYmm3BdkXDWlAeS0SeKCdSPKPm3ssXu88Td3VJIGA5ROqQ5/whLfwpvv2kiQiyV4Dz91Hv2tErMO0TQZDnGIpRKojR0PjMl/Q7J1I43CcSQfACu5NNRiBrWQiIxV5BA9RIWlTa26Ykrt5NinsOhuy80GRATR3pdBYGNTkMEyflnHzAB8BhMA1s3puqPjAViIhghMUwQhi5TVTa03F54WBfNeyqWM4jTJOaf+Ji7PI9HfI25mgyiVSXTgbcovs6SjuLg9R8+/ROTLzodWGqT4VTCWnJ2JJ/W0FzMelayDYtIgMBxVwpwPzkJRMYpq0EYE+MlJa8bQncgFeLbCgr2PWx5IQOr0jQTWTNPpTj1x7jFu3I44tjdxjgFH6TlZtakw1HbZK3AbUrvhm+y+KIDyoXGXWhB3S7SX02MTmqzGwXEKjn5aFFymA8ws0Ux1MXgoLxcastCDTx2pSmf3m3ZHqx/J1KnsvRXIwB5rSmsrw0T60YX4qcxj87CfsRQuSxLPWk2kgO4Ct2XnKjMDj/lK5mzbDEr3d1QK8Sze+nxqfq46+XqQSnLHYXbP9JBTyNQKv6gDvU+pEOT8ZxHEGkxgoHxbfS4f883gSQFwjM93YLSR8HRsF057pj6pMwrQBajbLaAeO550JshTHPN/OmAy3/VSlQ==</d:Value>
      <d:Description>Test certificate description.</d:Description>
      <d:Thumbprint>8044E2A478067D4F8867BB57A11006C1799A611D</d:Thumbprint>
      <d:ExpiryTime m:type="Edm.DateTime">2039-12-31T23:59:59</d:ExpiryTime>
      <d:CreationTime m:type="Edm.DateTime">2014-04-06T21:36:03.777</d:CreationTime>
      <d:LastModifiedTime m:type="Edm.DateTime">2014-04-06T21:36:03.777</d:LastModifiedTime>
    </m:properties>
  </content>
</entry>

Code Examples

The following example searches for a specific Variable, identified by the VariableID (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 certificate instance to search for.
                var certificateID = new Guid("50ed1abe-1487-463a-b9b1-7bea435413b2");

                // Query for the specific certificate instance identified by CertificateID.
                var certificate = SMAService.Certificates.Where(r => r.CertificateID == certificateID).FirstOrDefault();

                // Output select properties of the instance to the console.
                Console.WriteLine("Found Certificate ID  : {0}", certificate.CertificateID);
                Console.WriteLine("Found Certificate Name: {0}", certificate.Name);
                Console.WriteLine("Found Certificate Name: {0}", certificate.Description);
                Console.WriteLine("Found Certificate Name: {0}", certificate.Thumbprint);
                Console.WriteLine("Found Certificate Name: {0}", certificate.Value);
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                throw new ApplicationException("An error occurred during execution.", ex);
            }
        }                 
    }
}

See Also

Concepts

Certificate
Certificates