Returning a Response
Status Code
After sending a request, you will receive a response that includes a status code, response header, and response body.
A status code is a group of digits, ranging from 1xx to 5xx. It indicates the status of a request. For more information, see Status Code.
If 201 is returned for calling the API used to create a product, the request is successful.
Response Header Field
Similar to a request, a response also has a header, for example, Content-Type.
For the API used to create a product, the platform will return a response containing message headers, for example, Content-Type and Date.
Response Body
The body of a response is often returned in structured format as specified in the Content-Type header field. The response body transfers content except the response header.
For the API used to create a product, the following message body is returned: The following is part of the response body for the API used to create a product:
{ "product_id" : "5ba24f5ebbe8f56f5a14f605", "name" : "Thermometer", "device_type" : "Thermometer", "protocol_type" : "LWM2M", "data_format" : "binary", "manufacturer_name" : "ABC", "industry" : "smartCity", "description" : "this is a thermometer produced by Huawei", ...... }
If an error occurs during API calling, an error code and error description will be displayed. The following shows an error response body:
{ "error_msg": "The format of message is error", "error_code": "IOTDA.013005" }
In the preceding information, error_code is an error code, and error_msg describes the error.
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