CreateServiceCredential - Create a service credential

Updated at:

Creates a service credential for authenticating pipeline service connections.

Applicable editions

Central edition, Region edition

Service endpoint and authorization information

Product

Resource

Required permission

Pipeline

Service connection

Read and write

Request syntax

Central edition

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

Region edition

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

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

Your 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

The organization ID.

5ebbc0228123212b59xxxxx

-

object

body

No

name

string

body

Yes

The name of the service credential.

Zhang San's Git credential

password

string

body

Yes

The password.

zhangsan

scope

string

body

No

The visibility scope.

PERSON (private)

type

string

body

Yes

The type of the service credential. Default value: USERNAME_PASSWORD.

USERNAME_PASSWORD (username and password)

username

string

body

Yes

The username.

zhangsan

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/serviceCredentials' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "name": "Zhang San's Git credential",
        "password": "zhangsan",
        "scope": "PERSON (private)",
        "type": "USERNAME_PASSWORD (username and password)",
        "username": "zhangsan"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/serviceCredentials' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "name": "Zhang San\u0027s Git credential",
        "password": "zhangsan",
        "scope": "PERSON",
        "type": "USERNAME_PASSWORD",
        "username": "zhangsan"
    }'

Response parameters

Parameter

Type

Description

Example value

-

integer

The ID of the service credential.

11222

Response example

11222

Error codes

For more information, see Error codes.