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

Debugging a Script

Function

This API is used to debug the script. It is a synchronous API. (Invocation result is returned only after the function execution is complete.) When the conditions specified by the input parameters are met, the script is executed, and the debug log and execution result are displayed on the console.

The script can be executed only when it is saved and the input parameters are correct.

URI

POST Huawei Cloud Astro Zero domain name/u-route/baas/script/v1.0/debug/{scriptName}{?version=1.0.1}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

scriptName

Yes

String

Explanation

Script name. For details, see Logging In to the Application Designer. Go to the application designer and view the script name in the Logic > Script list.

Constraints

None

Value

None

Default value

None

version

No

String

Explanation

Version number of the script. If this parameter is not set, the script of the latest version is executed.

Constraints

None

Value

None

Default value

None

Request Parameters

The request parameters are the input parameters of the script.

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

result object

Explanation

Content returned when the request is successful.

Table 3 result parameters

Parameter

Type

Description

value

Any type

Explanation

Return value of the script.

log

String

Explanation

Debug log.

Value

None

Example Request

To debug the Namespace__editEquipment script, which contains the input parameters equipment, name, and Namespace__equipmentSN__CST, send the following request:

POST https://Huawei Cloud Astro Zero domain name/u-route/baas/script/v1.0/debug/Namespace__editEquipment?version=1.0.1  
{ 
    "equipment": { 
        "name": "No.14, Unit 1, Building A, Campus B",
        "Namespace__equipmentSN__CST": "32178900014"
    } 
}

Example Response

{
    "resCode": "0",
    "resMsg": "Success",
    "result": {
        "value": {
            "equipmentId": "c9uK000000iYJXUUnQcC"
        },
        "log": "***"
    }
}

Status Code

See Status Codes.

Error Code

See Error Codes.