Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Read using the HTTP GET operation.
Code Examples
Request
| Method | Request URI | HTTP Version |
|---|---|---|
GET |
HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Credentials(guid'<GUID>') |
HTTP/1.1 |
Request URI Parameters
| URI Parameter | Description |
|---|---|
GUID |
Required. The unique identifier value (CredentialID) for a Credential entity. |
Request URI Example
| Example URI |
|---|
GET https://sma-server:9090/00000000-0000-0000-0000-000000000000/Credentials(guid'ebc8f55e-008e-4dcc-b97b-45b0c1ae0505') 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://waplabvm4:9090/00000000-0000-0000-0000-000000000000/Credentials(guid'ebc8f55e-008e-4dcc-b97b-45b0c1ae0505')</id>
<category term="Orchestrator.ResourceModel.Credential" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Credential" href="Credentials(guid'ebc8f55e-008e-4dcc-b97b-45b0c1ae0505')" />
<title />
<updated>2014-04-16T16:51:05Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:CredentialID m:type="Edm.Guid">ebc8f55e-008e-4dcc-b97b-45b0c1ae0505</d:CredentialID>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
<d:Name>Test Credential Name</d:Name>
<d:UserName>TESTUSER2</d:UserName>
<d:RawValue m:null="true" />
<d:Value>grnTpoudLxK/Z6zSMI5v/w==</d:Value>
<d:Description>Updated test credential.</d:Description>
<d:CreationTime m:type="Edm.DateTime">2014-04-16T16:03:41.063</d:CreationTime>
<d:LastModifiedTime m:type="Edm.DateTime">2014-04-16T16:29:20.71</d:LastModifiedTime>
</m:properties>
</content>
</entry>
Code Examples
The following example searches for a specific Credential, identified by the CredentialID (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 credential instance to search for.
var credentialID = new Guid("159fb0d4-8c32-4388-8944-a7ac07678d18");
// Query for the specific credential instance identified by CredentialID.
var credential = SMAService.Credentials.Where(r => r.CredentialID == credentialID).FirstOrDefault();
// Output select properties of the instance to the console.
Console.WriteLine("Found Credential ID : {0}", credential.CredentialID);
Console.WriteLine("Found Credential Name : {0}", credential.Name);
Console.WriteLine("Found Credential UserName : {0}", credential.UserName);
Console.WriteLine("Found Credential Value : {0}", credential.Value);
Console.ReadKey();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex);
}
}
}
}