Update (PUT/MERGE) Connections
Update using the HTTP PUT/MERGE operation.
Code Examples
Request
Method | Request URI | HTTP Version |
---|---|---|
MERGE |
HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/Connections(guid'<GUID>') |
HTTP/1.1 |
Request URI Parameters
URI Parameter | Description |
---|---|
GUID |
Required. The unique identifier value (ConnectionID) for a Connection entity. |
Request URI Example
Example URI |
---|
MERGE https://waplabvm4:9090/00000000-0000-0000-0000-000000000000/Connections(guid'5b2be649-2d17-4d3a-861c-02656b6fae21') 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 PUT/MERGE request body.
<?xml version="1.0" encoding="utf-8"?>
<entry 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/Connections(guid'5b2be649-2d17-4d3a-861c-02656b6fae21')</id>
<category term="Orchestrator.ResourceModel.Connection" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<title />
<updated>2014-04-06T20:24:43Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:ConnectionID m:type="Edm.Guid">5b2be649-2d17-4d3a-861c-02656b6fae21</d:ConnectionID>
<d:ConnectionTypeID m:type="Edm.Guid">3921d613-e650-46da-bf19-1700c09f2d33</d:ConnectionTypeID>
<d:CreationTime m:type="Edm.DateTime">2014-04-06T19:14:52.14</d:CreationTime>
<d:Description>Modified Description</d:Description>
<d:LastModifiedTime m:type="Edm.DateTime">2014-04-06T19:14:52.14</d:LastModifiedTime>
<d:Name>Test Connection Name</d:Name>
<d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
</m:properties>
</content>
</entry>
Response
Response Codes
Response Code | Description |
---|---|
HTTP/1.1 204 No Content |
Request fulfilled. |
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
The PUT/MERGE operation has no response body.
Code Examples
The following example searches for a specific Connection, identified by the ConnectionID (a unique guid), and updates the 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 connection instance to search for.
System.Guid connectionID = new Guid("5b2be649-2d17-4d3a-861c-02656b6fae21");
// Query for the specific connection instance identified by ConnectionID.
var connection = SMAService.Connections.Where(r => r.ConnectionID == connectionID).FirstOrDefault();
// Modify connection instance property.
connection.Description = "Modified Description";
// Update the connection object.
// Note: This action is queued up until the SaveChanges action is called.
SMAService.UpdateObject(connection);
// Save all pending actions (client -> server communication initiated).
SMAService.SaveChanges();
}
catch (Exception ex)
{
throw new ApplicationException("An error occurred during execution.", ex);
}
}
}
}