CreateServiceConnection - Create a service connection

Updated at:

Create a service connection using OpenAPI.

Applicable editions

Central edition, Region edition

Endpoint and authorization information

  • Get the endpoint: Replace {domain} in the API request syntax.

  • Obtain a personal access token.

  • Obtain organizationId: Required only for the Central edition. Go to the Basic Information page in the Organization Management console to retrieve your organization ID.

Product

Resource

Required permission

Pipeline

Service connection

Read and write

Request syntax

Central edition

POST https://{domain}/oapi/v1/flow/organizations/{organizationId}/createServiceConnection

Region edition

POST https://{domain}/oapi/v1/flow/createServiceConnection

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

Personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

Location

Required

Description

Example value

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

Organization ID.

5ebbc0228123212b59xxxxx

-

object

body

No

authId

integer

body

No

Service authorization ID.

111

authType

string

body

No

Service authorization type.

CREDENTIAL (service certificate); AUTHENTICATION (service authorization)

connectionName

string

body

No

Service connection name.

ECS connection

connectionType

string

body

No

Service connection type.
Central edition: ecs Elastic Compute Service (ECS); Gitee; Github; docker_register_aliyun Container Registry (ACR); ack Container Service for Kubernetes (ACK); Codeup Apsara DevOps Codeup; oss Object Storage Service (OSS); edas Enterprise Distributed Application Service (EDAS); sae Serverless App Engine (SAE); ros Resource Orchestration Service (ROS); fc Function Compute (FC); emas Multiexperience Development Platform EMAS; PACKAGES Apsara DevOps Packages; customGitlab self-hosted GitLab; git generic Git; gitlab GitLab; bitbucket Bitbucket; jenkins Jenkins; private_docker_registry private image repository; ess Auto Scaling (ESS); atomGit AtomGit; svn SVN; gitlabAPI self-hosted GitLab (API V4 or later); vpc virtual private cloud (VPC).
Region edition: ecs Elastic Compute Service (ECS); Github; docker_register_aliyun Container Registry (ACR); ack Container Service for Kubernetes (ACK); Codeup Apsara DevOps Codeup; oss Object Storage Service (OSS); sae Serverless App Engine (SAE); PACKAGES Apsara DevOps Packages; customGitlab self-hosted GitLab; git generic Git; gitlab GitLab; bitbucket Bitbucket; private_docker_registry private image repository; gitlabAPI self-hosted GitLab (API V4 or later); vpc virtual private cloud (VPC).




ecs

scope

string

body

No

Visibility scope of the service connection.

PERSON (private); GLOBAL (public); CUSTOM (custom)

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/createServiceConnection' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "authId": 111,
        "authType": "CREDENTIAL (service certificate); AUTHENTICATION (service authorization)",
        "connectionName": "ECS connection",
        "connectionType": "ecs",
        "scope": "PERSON (private); GLOBAL (public); CUSTOM (custom)"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/createServiceConnection' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "authId": 111,
        "authType": "CREDENTIAL (service certificate); AUTHENTICATION (service authorization)",
        "connectionName": "ECS connection",
        "connectionType": "ecs",
        "scope": "PERSON (private); GLOBAL (public); CUSTOM (custom)"
    }'

Response parameters

Parameter

Type

Description

Example value

-

integer

Service connection ID.

19224

Response example

19224

Error codes

For API error codes, see the Error Code Center.