Response
Status Code
After sending a request, you will receive a response, including 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 response. For more information, see Status Code.
If status code 200 is returned for the calling of NLP APIs, the request is successful.
Response Header
Similar to a request, a response also has a header, for example, Content-Type, x-request-id. A response header in NLP has no special purpose and can be used to locate faults.
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 text classification API, the following request body is returned. For details about the format, see the text classification response.
{
"result": {
"content":"XXX Anti-Dandruff Shampoo, free delivery within the country",
"label": 0,
"confidence": 0.5190434
}
} If an error occurs during API calling, an error code and a message will be displayed. The following shows an error response body.
{
"error_code": "NLP.0301",
"error_msg": "query param error content.at least one of Chinese, English, or number;"
} In the response body, error_code is an error code, and error_msg provides information about the error.
Last Article: Authentication
Next Article: NLP APIs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.