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

Querying Data by Record ID

Function

This API is used to query data by record ID. It is a synchronous API. (Invocation result is returned only after the function execution is complete.)

Before calling this API, you must create an object and data records.

URI

GET Huawei Cloud Astro Zero domain name/u-route/baas/data/v1.0/bobject/{objectName}/{recordId}?fields={f1,f2}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

objectName

Yes

String

Explanation

Data object name. For details, see Logging In to the Application Designer. You can access the application designer and choose Data > Object to view data object names.

Constraints

None

Value

1–80 characters

Default value

None

recordId

Yes

String

Explanation

Record ID, which can be obtained by calling the API of Querying Data by Condition (id in the response message).

Constraints

None

Value

None

Default value

None

fields

No

Array

Explanation

Fields in the object. Multiple fields are separated by commas (,). If this parameter is specified, only the specified fields and necessary information (for example, data record owner and the owner ID) are returned. If this parameter is left unspecified, the entire data record is returned.

Constraints

None

Request Parameters

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

Array

Explanation

If the request is successful, there is only one object in the array, and the object contains the data record.

Example Request

To query a record whose ID is cfw0000000aKin6AQgfQ in the TestProject__testForObject__CST object, send the following request:

GET https://Huawei Cloud Astro Zero domain name/u-route/baas/data/v1.0/bobject/TestProject__testForObject__CST/cfw0000000aKin6AQgfQ

Example Response

{
    "resCode": "0",
    "resMsg": "Success",
    "result": [
        {
            "TestProject__address__CST": null,
            "createdBy": "10gd000000SDzgxNSckK",
            "createdBy.__objectType": "User",
            "createdBy.name": "test0xx",
            "createdDate": "2020-05-28 14:34:40",
            "currencyIsoCode": "",
            "id": "cfw0000000aKin6AQgfQ",
            "installedPackage": null,
            "lastModifiedBy": "10gd000000SDzgxNSckK",
            "lastModifiedBy.__objectType": "User",
            "lastModifiedBy.name": "test0xx",
            "lastModifiedDate": "2020-05-28 14:34:40",
            "name": "testd",
            "owner": "10gd000000SDzgxNSckK",
            "owner.__objectType": "User",
            "owner.name": "test0xx"
        }
    ]
}

Status Code

See Status Codes.

Error Code

See Error Codes.