Compartilhar via


Create (POST) ConnectionFieldValues

Update using the HTTP POST operation.

Code Examples

Request

Method Request URI HTTP Version

POST

HTTPS://<HOST>:<PORT>/00000000-0000-0000-0000-000000000000/ConnectionFieldValues

HTTP/1.1

Request URI Parameters

The POST operation has no parameters.

Request URI Example

Example URI

POST https://sma-server:9090/00000000-0000-0000-0000-000000000000/ConnectionFieldValues 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 POST 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">
  <category term="Orchestrator.ResourceModel.ConnectionFieldValue" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <id />
  <title />
  <updated>2014-04-30T17:45:45Z</updated>
  <author>
    <name />
  </author>
  <content type="application/xml">
    <m:properties>
      <d:ConnectionFieldID m:type="Edm.Guid">6b46cefa-84af-47ab-8080-5ca79c2843e5</d:ConnectionFieldID>
      <d:ConnectionFieldName m:null="true" />
      <d:ConnectionFieldValueID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:ConnectionFieldValueID>
      <d:ConnectionID m:type="Edm.Guid">e3d711f0-7dd5-404e-88b1-81e876dcb8c5</d:ConnectionID>
      <d:ConnectionName m:null="true" />
      <d:ConnectionTypeID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:ConnectionTypeID>
      <d:ConnectionTypeName m:null="true" />
      <d:CreationTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:CreationTime>
      <d:IsEncrypted m:type="Edm.Boolean">false</d:IsEncrypted>
      <d:IsOptional m:type="Edm.Boolean" m:null="true" />
      <d:LastModifiedTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:LastModifiedTime>
      <d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
      <d:Type m:null="true" />
      <d:Value>unencrypted-dac1ae38-2819-4bf4-82b3-de09747ac02b</d:Value>
    </m:properties>
  </content>
</entry>

Response

Response Codes

Response Code Description

HTTP/1.1 201 Created

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

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="https://smaserver: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://smaserver:9090/00000000-0000-0000-0000-000000000000/ConnectionFieldValues(guid'c7219106-5675-4a14-9ad5-c94e46f1b78e')</id>
  <category term="Orchestrator.ResourceModel.ConnectionFieldValue" scheme="https://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <link rel="edit" title="ConnectionFieldValue" href="ConnectionFieldValues(guid'c7219106-5675-4a14-9ad5-c94e46f1b78e')" />
  <link rel="https://schemas.microsoft.com/ado/2007/08/dataservices/related/Connection" type="application/atom+xml;type=entry" title="Connection" href="ConnectionFieldValues(guid'c7219106-5675-4a14-9ad5-c94e46f1b78e')/Connection" />
  <title />
  <updated>2014-04-30T17:45:46Z</updated>
  <author>
    <name />
  </author>
  <content type="application/xml">
    <m:properties>
      <d:TenantID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:TenantID>
      <d:ConnectionFieldValueID m:type="Edm.Guid">c7219106-5675-4a14-9ad5-c94e46f1b78e</d:ConnectionFieldValueID>
      <d:ConnectionID m:type="Edm.Guid">e3d711f0-7dd5-404e-88b1-81e876dcb8c5</d:ConnectionID>
      <d:ConnectionName m:null="true" />
      <d:ConnectionTypeID m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:ConnectionTypeID>
      <d:ConnectionTypeName m:null="true" />
      <d:Value>unencrypted-dac1ae38-2819-4bf4-82b3-de09747ac02b</d:Value>
      <d:ConnectionFieldID m:type="Edm.Guid">6b46cefa-84af-47ab-8080-5ca79c2843e5</d:ConnectionFieldID>
      <d:ConnectionFieldName m:null="true" />
      <d:IsEncrypted m:type="Edm.Boolean">false</d:IsEncrypted>
      <d:IsOptional m:type="Edm.Boolean" m:null="true" />
      <d:Type m:null="true" />
      <d:CreationTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:CreationTime>
      <d:LastModifiedTime m:type="Edm.DateTime">0001-01-01T00:00:00</d:LastModifiedTime>
    </m:properties>
  </content>
</entry>

Code Examples

The following example creates a new ConnectionFieldValue.

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://smaserver: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
            {
                // Create a new ConnectionFieldValue instance.
                var connectionFieldValue = new ConnectionFieldValue();

                // Populate properties with values.
                connectionFieldValue.ConnectionID = connection.ConnectionID;
                connectionFieldValue.ConnectionFieldID = connectionField.ConnectionFieldID;
                connectionFieldValue.Value = "unencrypted-" + Guid.NewGuid().ToString();
 
                // Add the new ConnectionFieldValue instance to the ConnectionFieldValue collection.
                // Note: This action is queued up until the SaveChanges action is called.
                SMAService.AddToConnectionFieldValues(connectionFieldValue);

                // Save all pending actions (client -> server communication initiated).
                SMAService.SaveChanges();

            }
            catch (Exception ex)
            {
                throw new ApplicationException("An error occurred during execution.", ex);
            }
        }                 
    }
}

See Also

Concepts

ConnectionFieldValue
ConnectionFieldValues