Share via


Update (PUT/MERGE) AdminConfigurations

Update using the HTTP PUT/MERGE operation.

Code Example

Request

Method Request URI HTTP Version

MERGE

HTTPS://<HOST>:<PORT>/<00000000-0000-0000-0000-000000000000/AdminConfigurations('<NAME>')

HTTP/1.1

Request URI Parameters

URI Parameter Description

NAME

Required. The unique identifier value (Name) for an AdminConfiguration entity.

Request URI Example

Example URI

MERGE https://sma-server:9090/00000000-0000-0000-0000-000000000000/AdminConfigurations('DrainTimeInSeconds') 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://waplabvm4:9090/00000000-0000-0000-0000-000000000000/AdminConfigurations('DrainTimeInSeconds')</id>
  <category term="Orchestrator.ResourceModel.AdminConfiguration" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <title />
  <updated>2014-03-31T15:51:16Z</updated>
  <author>
    <name />
  </author>
  <content type="application/xml">
    <m:properties>
      <d:LastModifiedTime m:type="Edm.DateTime">2014-03-31T15:34:03.297</d:LastModifiedTime>
      <d:Name>DrainTimeInSeconds</d:Name>
      <d:Value>60</d:Value>
    </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 Example

The following example searches for a specific AdminConfiguration, identified by the Name (a unique string), 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 AdminConfiguration instance to search for.
                string AdminConfigurationName = "DrainTimeInSeconds";

                // Query for the specific AdminConfiguration instance identified by Name (the key value is Name).
                AdminConfiguration AdminConfiguration = SMAService.AdminConfigurations.Where(r => r.Name == AdminConfigurationName).FirstOrDefault();

                // Modify the DrainTimeInSeconds value of the local instance.
                AdminConfiguration.Value = "60";

                // Save the modified DrainTimeInSeconds value.
                SMAService.UpdateObject(AdminConfiguration);
                SMAService.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new ApplicationException("An error occurred during execution.", ex);
            }
        }
    }
}

See Also

Concepts

AdminConfiguration
AdminConfigurations