Updated on 2025-05-13 GMT+08:00

Deleting Data by Condition

Function

This API is used to delete data by condition.

URI

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

Table 1 URI parameter

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

Request Parameters

Table 2 Request parameter

Parameter

Mandatory

Type

Description

condition

Yes

Object

Explanation

Condition used for deletion. If this parameter is left unspecified, all object data is deleted. This parameter contains the following elements:

  • conjunction: number of conditions to meet.
    • AND: All conditions must be met.
    • OR: At least one condition must be met.
  • conditions: array of conditions. If this parameter is left unspecified, all object data is queried. If this parameter is specified, each element contains the following fields:
    • field: field name, which is a string.
    • operator: operator, which is a string.
    • value: comparison value, which is a string.
  • relation: The array contains parents (upward query) and children (downward query).

    The parents field contains the condition array and relatedField (name of the associated field). The children field contains the condition array and relationName (name of the associated field).

    The condition array contains the following fields:

    • conjunction: The value can be AND or OR.
    • conditions: same as the preceding conditions parameter.
    • relation: same as the preceding relation parameter.

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

Number

Explanation

Number of deleted records.

Value

None

Example Request

To delete records where name is test in the TestProject__testForObject1__CST object, send the following request:
POST https://Huawei Cloud Astro Zero domain name/u-route/baas/data/v1.0/delete/TestProject__testForObject1__CST
 {
    "condition": {
        "conjunction": "AND",
        "conditions": [
            {
                "field": "NAME",
                "operator": "eq",
                "value": "test"
            }
        ]
    }
}

Example Response

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

Status Code

See Status Codes.

Error Code

See Error Codes.