CreateVariableGroup - Create a variable group

Updated at:

Applicable versions

Central Edition, Regional Edition

Endpoint and authorization information

  • Obtain the endpoint and use it to replace {domain} in the request syntax.
  • Obtain a personal access token.
  • Obtain the organizationId. This parameter is required only for the Central Edition. To obtain the organization ID, go to the Basic Information page in the Organization Management console.

Product

Resource

Required permission

Application Delivery

Variable group

Read/Write

Request syntax

Central Edition

POST https://{domain}/oapi/v1/appstack/organizations/{organizationId}/apps/{appName}/variableGroup

Regional Edition

POST https://{domain}/oapi/v1/appstack/apps/{appName}/variableGroup

Request headers

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

A personal access token.

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

Request parameters

Parameter

Type

Position

Required

Description

Example

appName

string

path

Yes

The application name.

my-web-service

organizationId

string

path

  • Yes: Central Edition

  • No: Regional Edition

The organization ID.

ec766e63aee3437d9a51f334d6exe671

-

object

body

No

The variable group model.

branchName

string

body

No

The branch name. The default value is master.

master

displayName

string

body

No

The display name of the variable group.

dev

fromRevisionSha

string

body

Yes

The version number of the variable group.

1.0.0

message

string

body

No

The description of the variable group.

message

name

string

body

No

The unique name of the variable group.

dev

vars

array

body

No

A list of variables.

-

object

body

No

A variable model.

description

string

body

No

The description of the variable.

namespace

key

string

body

No

The key of the variable.

namespace

value

string

body

No

The value of the variable.

default

Request examples

Central Edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/appstack/organizations/ec766e63aee3437d9a51f334d6exe671/apps/my-web-service/variableGroup' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "branchName": "master",
        "displayName": "dev",
        "fromRevisionSha": "1.0.0",
        "message": "message",
        "name": "dev",
        "vars": [
            {
                "description": "namespace",
                "key": "namespace",
                "value": "default"
            }
        ]
    }'

Regional Edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/appstack/apps/my-web-service/variableGroup' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "branchName": "master",
        "displayName": "dev",
        "fromRevisionSha": "1.0.0",
        "message": "message",
        "name": "dev",
        "vars": [
            {
                "description": "namespace",
                "key": "namespace",
                "value": "default"
            }
        ]
    }'

Response parameters

Parameter

Type

Description

Example

-

object

The version record of the variable group.

displayName

string

The display name of the variable group.

dev-xxxx

name

string

The name of the variable group.

dev

revision

object

Version information.

author

string

The user who submitted the commit.

10df6011-2837-4fdb-ad92-356a679a60ca

commitTime

number

The time of the commit.

1.63e+12

message

string

The commit message for the version.

message-xxxx

refs

array[string]

Associated information.

repoMeta

object

Repository information.

name

string

The repository name.

my-repo

type

string

The repository type.

VARIABLE

sha

string

The SHA value of the version.

a80102ee37cca462a23865e7a3e66ac1ca032a5c

type

string

The type. Possible values: [GLOBAL, TEMPLATE, APP].

GLOBAL

vars

array

A list of variables.

-

object

A variable model.

description

string

The description of the variable.

namespace

key

string

The key of the variable.

namespace

value

string

The value of the variable.

default

Response example

{
    "displayName": "dev-xxxx",
    "name": "dev",
    "revision": {
        "author": "10df6011-2837-4fdb-ad92-356a679a60ca",
        "commitTime": 1.63e+12,
        "message": "message-xxxx",
        "refs": [
            
        ],
        "repoMeta": {
            "name": "my-repo",
            "type": "VARIABLE"
        },
        "sha": "a80102ee37cca462a23865e7a3e66ac1ca032a5c"
    },
    "type": "GLOBAL",
    "vars": [
        {
            "description": "namespace",
            "key": "namespace",
            "value": "default"
        }
    ]
}

Error codes

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