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

Adding Data to an Object

Function

This API is used to add data to an object. It is a synchronous API. (Invocation result is returned only after the function execution is complete.)

Before adding data to an object, you must create an object.

URI

POST Huawei Cloud Astro Zero domain name/u-route/baas/data/v1.0/bobject/{objectName}

Table 1 URI parameter

Parameter

Mandatory

Type

Description

objectName

Yes

String

Explanation

Name of the data object to be created

Constraints

None

Value

1–80 characters

Default value

None

Request Parameters

Table 2 Request parameter

Parameter

Mandatory

Type

Description

records

Yes

Array

Explanation

An object array consisting of attributes and values.

Constraints

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

Array

Explanation

An object array of record IDs.

Example Request

To add two records to the TestProject__testForObject__CST object, send the following request:

POST https://Huawei Cloud Astro Zero domain name/u-route/baas/data/v1.0/bobject/TestProject__testForObject__CST
 
{
    "records": [
        {
            "name": "name1"
        },
        {
            "name": "name2"
        }
    ]
}

Example Response

{
    "resCode": "0",
    "resMsg": "Success",
    "result": [
        {
            "id": "cfw0000000aKmGskAsDo"
        },
        {
            "id": "cfw0000000aKmGskAsDp"
        }
    ]
}

Status Code

See Status Codes.

Error Code

See Error Codes.