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

Creating a Custom Object

Function

This API is used to create a custom object.

URI

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

Request Parameters

Table 1 Request parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Explanation

Name of the custom object.

Constraints

The value cannot be changed after being specified.

Value

The value must start with a letter and can contain only letters, digits, and underscores (_). It cannot end with an underscore (_) and can contain a maximum of 63 characters.

Default value

None

label

No

String

Explanation

Alias of an object, which can be modified after being created.

Constraints

None

Value

1–80 characters

Default value

None

description

No

String

Explanation

Description of the object.

Constraints

None

Value

1–80 characters

Default value

None

fields

Yes

Array of field object

Explanation

Object fields. For details about the field parameters, see Table 2.

Constraints

None

Table 2 fields parameters

Parameter

Mandatory

Type

Description

label

Yes

String

Explanation

Label of the new field.

Constraints

None

Value

1–80 characters

Default value

None

name

Yes

String

Explanation

Name of the new field.

Constraints

The value cannot be changed after being specified.

Value

The value must start with a letter and can contain only letters, digits, and underscores (_). It cannot end with an underscore (_) and can contain a maximum of 63 characters.

Default value

None

dataType

Yes

String

Explanation

Type of the new field.

Constraints

The value cannot be changed after being specified.

Value

  • text: You can enter a maximum of 255 characters, including any combination of letters and digits.
  • encryptedtext: You can enter a maximum of 111 characters and store them in encrypted format, including any combination of letters and digits.
  • textarea: You can enter up to 1,048,576 characters in multiple lines.
  • number: You can enter any digit. Leading zeros are removed.
  • percent: You can enter a percentage number, for example, 10, and the percent sign is automatically added to the number.
  • phone: You can enter any phone number, which is automatically displayed in the phone number format.
  • currency: You can enter amounts in other currencies, which will automatically be converted to the correct format. This function is useful when exporting data to Excel or other spreadsheets.
  • date: You can enter a date or select a date from the calendar that is displayed.
  • datetime: You can enter a date and time or select a date from the calendar that is displayed. When you click a date in the calendar that is displayed, the date and current time are shown in this field.
  • email: You can enter an email address. The system validates the email address format. If this field is specified for a contact or a potential customer, you can select an address when you send an email. Note that custom e-mail addresses cannot be used for bulk e-mail.
  • checkbox: You can select a true (checked) or false (unchecked) value.
  • singleselect: You can select a value from a defined list.
  • multiselect: You can select multiple values from a defined list.
  • url: You can enter any valid URL. When you click this field, you will visit the URL in a separate browser window.
  • lookup: You can create a relationship that associates this object to another object.
  • autonumber: The system generates serial numbers in the format that you define. The sequence number increases by one for each newly added record.
  • formula: The system generates a read-only field in the formula expression that you define. If the source field used in any expression is changed, the value of this field will be updated.
  • masterdetail: You can create a type of primary/secondary relationship between one object and another. Ownership of detailed records is determined by the master record. When you delete the master record, all detailed records will be deleted.
  • multilanguage: You can select content in multiple languages from the customized resource table.
  • attachment: You can save the addresses of multiple uploaded files. Images and documents are supported.

Default value

None

Response Parameters

Table 3 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 an object instance, send the following request:

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

{
    "label": "VehicleType",
    "name": "VehicleType__CST",
    "description": "",
    "fields": [
        {
            "label": "Name",
            "name": "name",
            "dataType": "Name"
        }
    ]
}

Example Response

{
    "resCode":"0",
    "resMsg": "Success",
    "result":"cust***aKtFZpERvc"
}     

Status Code

See Status Codes.

Error Code

See Error Codes.