Running a Script
Function
This API is used to run the script. It is a synchronous API. (Invocation result is returned only after the function execution is complete.) When the conditions specified by input parameters are met, the script is executed. No log is displayed on the console, but the execution result is displayed.
URI
POST Huawei Cloud Astro Zero domain name/u-route/baas/script/v1.0/run/{scriptName}{?version=1.0.1}
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 parameters in the request body are custom input parameters defined in the script.
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 |
Object |
Explanation Content returned when the request is successful. |
Example Request
To run 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/run/Namespace__editEquipment?version=1.0.1 { "equipment": { "name": "No.16, Unit 1, Building A, Campus B", "Namespace__equipmentSN__CST": "3217890020" } }
Example Response
{ "resCode": "0", "resMsg": "Success", "result": { "value": { "equipmentId": "c9uK000000iYJt41oj8S" }, "log": "" } }
Status Code
See Status Codes.
Error Code
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot