CreateVariableGroup - Create a variable group

Updated at:

This topic describes how to create a variable group using OpenAPI.

Applicable editions

Central edition, Region edition

Service endpoints and authorization information

  • Get service endpoints: Replace the {domain} variable in the API request syntax with the obtained endpoint.
  • Get a personal access token.
  • Obtain the organization ID. This parameter is required only for the Central edition. You can obtain the organization ID from the Basic Information page in the Organization Management console.

Product

Resource

Required permissions

Pipeline

Variable group

Read/write

Request syntax

Central edition

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

Region edition

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

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

Enterprise ID.

5ebbc0228123212b59xxxxx

description

string

query

No

Description of the variable group.

Description of the variable group

variables

string

query

Yes

JSON string of variable information. isEncrypted indicates whether to encrypt the variable. name is the variable name. value is the variable value.

[{"isEncrypted":true,"name":"name1","value":"vaue1"}]

name

string

query

Yes

Name of the variable group.

Variable group

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/variableGroups?description=Description%20of%20the%20variable%20group&variables=[{"isEncrypted":true,"name":"name1","value":"vaue1"}]&name=Variable%20group' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/variableGroups?description=Description%20of%20the%20variable%20group&variables=[{"isEncrypted":true,"name":"name1","value":"vaue1"}]&name=Variable%20group' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Return parameters

Parameter

Type

Description

Example value

-

integer

ID of the new variable group.

1234

Return example

1234

Error codes

For more information about API error codes, see the Error Code Center.