Read (GET) Statistics
Read using the HTTP GET operation.
Code Examples
Request
Method | Request URI | HTTP Version |
---|---|---|
GET |
HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Statistics(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/Statistics(guid'6f5f35df-dc9f-4da9-a744-a83dd2a26073') 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://waplabvm4: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/Statistics(guid'6f5f35df-dc9f-4da9-a744-a83dd2a26073')</id>
<category term="Orchestrator.ResourceModel.Statistics" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Statistics" href="Statistics(guid'6f5f35df-dc9f-4da9-a744-a83dd2a26073')" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/Runbook" type="application/atom+xml;type=entry" title="Runbook" href="Statistics(guid'6f5f35df-dc9f-4da9-a744-a83dd2a26073')/Runbook" />
<title />
<updated>2014-03-31T22:42:47Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:RunbookID m:type="Edm.Guid">6f5f35df-dc9f-4da9-a744-a83dd2a26073</d:RunbookID>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
<d:CompletedCount m:type="Edm.Int32">1</d:CompletedCount>
<d:FailedCount m:type="Edm.Int32">0</d:FailedCount>
<d:RunningCount m:type="Edm.Int32">0</d:RunningCount>
<d:TotalJobCount m:type="Edm.Int32">1</d:TotalJobCount>
<d:SuspendedCount m:type="Edm.Int32">0</d:SuspendedCount>
<d:StoppedCount m:type="Edm.Int32">0</d:StoppedCount>
<d:LastStart m:type="Edm.DateTime">2014-03-24T18:00:05.697</d:LastStart>
</m:properties>
</content>
</entry>
Code Examples
The following example searches for a specific Statistics instance, identified by the RunbookID (a unique guid value) and lists some values.
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://waplabvm4: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("6f5f35df-dc9f-4da9-a744-a83dd2a26073");
// Query for the specific statistics instance associated with the RunbookID.
var statistics = SMAService.Statistics.Where(r => r.RunbookID == RunbookID).FirstOrDefault();
// Output select properties of the statistics instance to the console.
Console.WriteLine("Found Runbook ID : {0}", statistics.RunbookID);
Console.WriteLine("Found Completed Count : {0}", statistics.CompletedCount);
Console.WriteLine("Found Failed Count : {0}", statistics.FailedCount);
Console.WriteLine("Found Total Job Count : {0}", statistics.TotalJobCount);
Console.ReadKey();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex);
}
}
}
}