Batch Adding or Updating Object Data
Function
This API is used to add or update data records in batches. If the request contains id, it is used to update data. If the request does not contain id, it is used to add data.
URI
POST Huawei Cloud Astro Zero domain name/u-route/baas/data/v1.0/upsert/{objectName}
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
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
records |
Yes |
Array |
Explanation Array of the data to be added or updated. Constraints If the parameter value contains id, the request is used to update data. Otherwise, the request is used to add data. |
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, an array of record IDs is returned. |
Example Request
POST https://Huawei Cloud Astro Zero domain name/u-route/baas/data/v1.0/upsert/TestProject__testForObject1__CST { "records":[ { "name":"zhang", "TestProject__length__CST":"17" }, { "name":"li", "TestProject__length__CST":"30" }, { "name":"wang", "TestProject__length__CST":"20" } ] }
Example Response
{ "resCode": "0", "resMsg": "Success", "result": [ { "id": "cglE000000aMFjB9ipAu" }, { "id": "cglE000000aMFjB9ipAv" }, { "id": "cglE000000aMFjB9ipAw" } ] }
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