Updated on 2025-08-14 GMT+08:00

Creating a Picklist Instance

Function

Create a picklist instance, that is, go to the Data > Picklists page in the application designer. You can customize the option list used in the application.

URI

POST Huawei Cloud Astro Zero domain name/u-route/baas/metadata/v1.0/picklist

Request Parameters

Table 1 Request parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Explanation

Name of the picklist instance.

Constraints

If a namespace is set for the environment, add the prefix Namespace__ to the name.

Value

Start with a letter and can contain only letters, digits, and single underscores (_). There is no consecutive underscore (_) and the value cannot end with an underscore (_). A maximum of 64 characters are allowed.

Default value

None

masterLabel

Yes

String

Explanation

Label of the picklist instance.

Constraints

None

Value

1–64 characters

Default value

None

description

No

String

Explanation

Description of the Picklist instance.

Constraints

None

Value

1–255 characters

Default value

None

useFirstAsDefault

No

String

Explanation

Whether the first value is used as the default value.

Constraints

None

Value

None

Default value

None

picklistValues

No

Array

Explanation

One or more values of the Picklist instance. Semicolons (;) are not allowed in the value.

Constraints

None

Response Parameters

Table 2 Response parameters

Parameter

Type

Description

resCode

String

Explanation

Return code.

Value

If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

resMsg

String

Explanation

Message returned.

Value

If the request is successful, "Success" is returned. In other cases, an error message is returned.

result

string

Explanation

If the request is successful, an ID is returned.

Value

None

Example Request

To create a Picklist instance, send the following request:
POST https://Huawei Cloud Astro Zero domain name/u-route/baas/metadata/v1.0/Picklist
{
    "name": "CNAME1__testName",
    "picklistValues": [
        {
            "label": "A",
            "value": "A"
        },
        {
            "label": "B",
            "value": "B"
        },
        {
            "label": "C",
            "value": "C"
        }
    ],
    "masterLabel": "Label for pick list ABC"
}

Example Response

{
    "resCode": "0",
    "resMsg": "Success",
    "result": "0004000001MPkyhd1gHo"
}

Status Code

See Status Codes.

Error Code

See Error Codes.