共用方式為


Create a connection

 

The Create a connection operation creates a new connection instance based on the specified connection type.

You must first Create a connection type that defines the fields available for this connection, or use a global connection type. Then you must specify values in the request body that match the fields defined in the connection type.

Request

To specify the request, replace <subscription-id> with your subscription ID, <cloud-service-name> with the name of the cloud service to use for making the request, <automation-account-name> with the name of the automation account to use for making the request, and <connection-name> with a name for the connection. Include required URI parameters.

Method

Request URI

PUT

https://management.core.windows.net/<subscription-id>/cloudServices/<cloud-service-name>/resources/automation/~/automationAccounts/<automation-account-name>/connections/<connection-name>?api-version=2014-12-08

URI Parameters

Uri Parameter

Description

api-version

Required. Must be set to 2014-12-08.

Request Headers

The request headers in the following table are required.

Request Header

Description

Content-Type

Set to application/json. Do not include a specification for charset.

x-ms-version

Specifies the version of the operation. Set to 2013-06-01 or a later version.

Request Body

This example creates a connection for the LitwareTwitter connection type.

Important

You must specify the name for the connection both in the request body and in the request URI.

{
   "name":"Twitter",
   "properties":{
      "description":"Twitter connection",
      "connectionType":{
         "name":"LitwareTwitter"
      },
      "fieldDefinitionValues":{
         "Owner":"Litware East US",
         "ConsumerAPIKey":"Pv6bmBg5uE2xXBUPQP9tmyW/DDB15LJAoXiT6NJFymE=",
         "ConsumerAPISecret":"C2ziW4nwt06xLTE4F5yrEfM3WSKol1JIjf0TG5RPchF0SMUnig1eSZhd/ol5KDwnLAuSm34ctkSQcfm0zEvTPlddqFvPxgFOhfmU4qapDkjXyZ82ZCcjSqAbyiYQnlTJmszzKyTHUESccBcPihHJ0iYP0CTTIb5Brr/SiVM/hxscrKizWR5aTLSUON9ga6kGqerCPQnP4EyZls/NsbGfbx8xOEh3N+FFnRFqyu5BAMxwkRf5Aat6S40vvvRNR7naVD6Zg6zTnkqnGPVpeud2ayjfkBfRPWRKkinmIcCTUICI4YvYGTgNRqbUanpV8932+wZKW6GfbUOv/y8h3/01Aw==",
         "AccessToken":"asBcGOJsDE6r552BCT6rTbvBnkBP775KiFM0MNwgn2U=",
         "AccessTokenSecret":"8j7bUCcjhkK9W8SxhmSspvWMBxMysSZKt4xwelcgPEUQL2T4y3T+RKyrvfHLsP0zEPL77R62W0aTD6zt7Luueb7B9YZIFIBOt35UwRTXCKlzWP9SZj4RQKe/q6nKGB/tigFkGnhE1kqorao1+G/r3bizAQXCkONPh7Tr6v5yUFx+e8sxNJsbQodJk7/NUp23CxjuXXHmyEuicDExMwicTCBbY/SdjzhAkvc3q7PBSBat4ymJKB+KSrS4hogTa+3dcbJvtHU7mEymlPE3cUWRFu9XbsjGo7JDn3NOlKxZkX+5gFk4LlVtT7Mn4hPVAiCodDdnkvXSoEWuQ5qgU/ZA4Q=="
      }
   }
}

Element

Description

name

Name of the connection type. Note that the name is also provided in the URI and they must match.

description

A description of the connection.

connectionType/Name

The name of the connection's connection type.

fieldDefinitionValues

The required fields and their values required by the connection type.

Response

Status Code

A successful operation returns 201 (Created). For information about common error codes, see HTTP/1.1 Status Code Definitions.

Response Headers

Request Header

Description

x-ms-request-id

A unique identifier for the current operation.

Response Body

{
   "name":"Twitter",
   "properties":{
      "creationTime":"2015-05-19T17:27:07.93+00:00",
      "lastModifiedTime":"2015-05-19T17:27:07.93+00:00",
      "description":"Twitter connection",
      "fieldDefinitionValues":{
         "Owner":"Litware East US",
         "ConsumerAPIKey":"Pv6bmBg5uE2xXBUPQP9tmyW\/DDB15LJAoXiT6NJFymE=",
         "ConsumerAPISecret":"C2ziW4nwt06xLTE4F5yrEfM3WSKol1JIjf0TG5RPchF0SMUnig1eSZhd\/ol5KDwnLAuSm34ctkSQcfm0zEvTPlddqFvPxgFOhfmU4qapDkjXyZ82ZCcjSqAbyiYQnlTJmszzKyTHUESccBcPihHJ0iYP0CTTIb5Brr\/SiVM\/hxscrKizWR5aTLSUON9ga6kGqerCPQnP4EyZls\/NsbGfbx8xOEh3N+FFnRFqyu5BAMxwkRf5Aat6S40vvvRNR7naVD6Zg6zTnkqnGPVpeud2ayjfkBfRPWRKkinmIcCTUICI4YvYGTgNRqbUanpV8932+wZKW6GfbUOv\/y8h3\/01Aw==",
         "AccessToken":"asBcGOJsDE6r552BCT6rTbvBnkBP775KiFM0MNwgn2U=",
         "AccessTokenSecret":"8j7bUCcjhkK9W8SxhmSspvWMBxMysSZKt4xwelcgPEUQL2T4y3T+RKyrvfHLsP0zEPL77R62W0aTD6zt7Luueb7B9YZIFIBOt35UwRTXCKlzWP9SZj4RQKe\/q6nKGB\/tigFkGnhE1kqorao1+G\/r3bizAQXCkONPh7Tr6v5yUFx+e8sxNJsbQodJk7\/NUp23CxjuXXHmyEuicDExMwicTCBbY\/SdjzhAkvc3q7PBSBat4ymJKB+KSrS4hogTa+3dcbJvtHU7mEymlPE3cUWRFu9XbsjGo7JDn3NOlKxZkX+5gFk4LlVtT7Mn4hPVAiCodDdnkvXSoEWuQ5qgU\/ZA4Q=="
      },
      "connectionType":{
         "name":"LitwareTwitter"
      }
   }
}

Element

Description

name

Name of the connection.

creationTime

The date and time the connection was created.

lastModifiedTime

The date and time the connection was last modified.

fieldDefinitionValues

This connection's fields and current values.

connectionType/Name

The name of this connection's connection type.

See Also

Automation Connections
Operations on Automation