Read (GET) Activities
Read using the HTTP GET operation.
Code Examples
Request
Method | Request URI | HTTP Version |
---|---|---|
GET |
HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Activities(guid'<GUID>') |
HTTP/1.1 |
Request URI Parameters
URI Parameter | Description |
---|---|
GUID |
Required. The unique identifier value (ActivityID) for an Activity entity. |
Request URI Example
Example URI |
---|
GET https://<sma-server>:9090/00000000-0000-0000-0000-000000000000/Activities(guid'd61bdd0a-7df7-4284-97b2-a50746443ab7') 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://waplabvm4:9090/00000000-0000-0000-0000-000000000000/Activities(guid'd61bdd0a-7df7-4284-97b2-a50746443ab7')</id>
<category term="Orchestrator.ResourceModel.Activity" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Activity" href="Activities(guid'd61bdd0a-7df7-4284-97b2-a50746443ab7')" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/Module" type="application/atom+xml;type=entry" title="Module" href="Activities(guid'd61bdd0a-7df7-4284-97b2-a50746443ab7')/Module" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/ActivityParameterSets" type="application/atom+xml;type=feed" title="ActivityParameterSets" href="Activities(guid'd61bdd0a-7df7-4284-97b2-a50746443ab7')/ActivityParameterSets" />
<link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/ActivityOutputTypes" type="application/atom+xml;type=feed" title="ActivityOutputTypes" href="Activities(guid'd61bdd0a-7df7-4284-97b2-a50746443ab7')/ActivityOutputTypes" />
<title />
<updated>2014-03-28T19:41:13Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:ActivityID m:type="Edm.Guid">d61bdd0a-7df7-4284-97b2-a50746443ab7</d:ActivityID>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
<d:Name>Get-AutomationCertificate</d:Name>
<d:Definition></d:Definition>
<d:Tags m:null="true" />
<d:CreationTime m:type="Edm.DateTime">2014-02-07T18:33:13.25</d:CreationTime>
<d:LastModifiedTime m:type="Edm.DateTime">2014-02-07T18:33:13.25</d:LastModifiedTime>
<d:ModuleID m:type="Edm.Guid">4b2c0b8e-fda9-4c43-af07-2309c8d6165c</d:ModuleID>
<d:Description xml:space="preserve">
Get-AutomationCertificate [[-Name] <string>]
</d:Description>
<d:Type m:null="true" />
<d:ModuleName>RunbookConstructs</d:ModuleName>
</m:properties>
</content>
</entry>
Code Examples
The following example searches for a specific activity, identified by the ActivityID (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://waplabvm4:9090/00000000-0000-0000-0000-000000000000";
// Setup the connection to SMA
OrchestratorApi api = new OrchestratorApi(new Uri(serviceEndPoint));
// Set credentials to the default or to a specific user.
((DataServiceContext)api).Credentials = CredentialCache.DefaultCredentials;
// ((DataServiceContext)api).Credentials = new NetworkCredential("user", "pwd", "domain");
try
{
// Identify a specific activity instance to search for.
System.Guid ActivityID = new Guid("d61bdd0a-7df7-4284-97b2-a50746443ab7");
// Query for the specific activity instance identified by ActivityID.
Activity activity = api.Activities.Where(r => r.ActivityID == ActivityID).FirstOrDefault();
// Output select properties of the instance to the console.
Console.WriteLine("Found Activity ID : {0}", activity.ActivityID);
Console.WriteLine("Found Activity Name: {0}", activity.Name);
Console.ReadKey();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex);
}
}
}
}