CreateGlobalVar - Create a global variable group

Updated at:

Applicable editions

Centralized edition, region edition

Endpoint and authorization information

  • Get the endpoint: Replace {domain} in the API request syntax.
  • Get your personal access token.
  • Get your organization ID: Required only for the centralized edition. Go to the organization management console and find your ID on the basic information page.

Product

Resource

Required permissions

Application Delivery

global variable group

read and write

Request syntax

Centralized edition

POST https://{domain}/oapi/v1/appstack/organizations/{organizationId}/globalVars

Region edition

POST https://{domain}/oapi/v1/appstack/globalVars

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

Position

Required

Description

Example value

organizationId

string

path

  • Yes: centralized edition

  • No: region edition

The organization ID.

ec766e63aee3437d9a51f334d6exe671

-

object

body

No

The request body for creating the global variable group.

content

array

body

No

A list of variables.

-

object

body

No

The 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

displayName

string

body

Yes

The display name for the global variable group.

my-display-name

message

string

body

No

The commit message for this action.

env config for og

name

string

body

Yes

The name of the global variable group.

my-global-var-group

ownerId

string

body

No

The ID of the owner of the global variable group.

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

Request example

Centralized edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/appstack/organizations/ec766e63aee3437d9a51f334d6exe671/globalVars' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "content": [
            {
                "description": "namespace",
                "key": "namespace",
                "value": "default"
            }
        ],
        "displayName": "my-display-name",
        "message": "env config for og",
        "name": "my-global-var-group",
        "ownerId": "10df6011-2837-4fdb-ad92-356a679a60ca"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/appstack/globalVars' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "content": [
            {
                "description": "namespace",
                "key": "namespace",
                "value": "default"
            }
        ],
        "displayName": "my-display-name",
        "message": "env config for og",
        "name": "my-global-var-group",
        "ownerId": "10df6011-2837-4fdb-ad92-356a679a60ca"
    }'

Response parameters

Parameter

Type

Description

Example value

-

object

The created global variable group.

content

array

The list of variables in the global variable group.

-

object

The 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

creator

string

The ID of the user who created the global variable group.

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

displayName

string

The display name of the global variable group.

my-display-name

gmtCreate

string

The creation time of the global variable group.

2024-01-01 00:00:00

gmtModified

string

The last modification time of the global variable group.

2024-01-01 00:00:00

modifier

string

The ID of the user who made the last modification.

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

name

string

The name of the global variable group.

my-global-var-group

revision

object

The commit revision details.

author

string

The author of the commit.

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

commitTime

number

The commit timestamp.

1.63e+12

message

string

The commit message.

message-xxxx

refs

array[string]

Associated references, such as branches or tags.

repoMeta

object

Repository metadata.

name

string

The repository name.

my-repo

type

string

The repository type.

VARIABLE

sha

string

The commit SHA.

a80102ee37cca462a23865e7a3e66ac1ca032a5c

Response example

{
    "content": [
        {
            "description": "namespace",
            "key": "namespace",
            "value": "default"
        }
    ],
    "creator": "10df6011-2837-4fdb-ad92-356a679a60ca",
    "displayName": "my-display-name",
    "gmtCreate": "2024-01-01 00:00:00",
    "gmtModified": "2024-01-01 00:00:00",
    "modifier": "10df6011-2837-4fdb-ad92-356a679a60ca",
    "name": "my-global-var-group",
    "revision": {
        "author": "10df6011-2837-4fdb-ad92-356a679a60ca",
        "commitTime": 1.63e+12,
        "message": "message-xxxx",
        "refs": [
            
        ],
        "repoMeta": {
            "name": "my-repo",
            "type": "VARIABLE"
        },
        "sha": "a80102ee37cca462a23865e7a3e66ac1ca032a5c"
    }
}

Error codes

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