Response Results

Upon receiving an API request, Milesight Development Platform responds with an HTTP status code that indicates the request result, and a JSON response body that contains information requested by the API call.

Success response example

Description

For a successful request, Milesight Development Platform returns an HTTP status code 200, and a response body that contains the information requested by the API call, as the following table shows:

Parameter Type Description
data Object The detailed information that is requested by the API call.
status String The result of a request.

In a success response, the status is Success.

requestId String The unique ID of the request, which can be used to quickly locate the request.
Example
The example below shows a success response of Get an Access Token.
HTTP/1.1 200 OK
{
    "data": {
        "access_token": "eyJhbGciOiJSUzI1iIsR5xxxxxxxxxxxxxxxxxxxxxxxxxx",
        "refresh_token": "eyJhbGciOiJSUz1N8l6bHEtXNxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "expires_in": 3599
        "refresh_token_expires_in": 2591999
    },
    "status": "Success",
    "requestId": "72fea33ad6f721a3a218cc6f60c5fff1"
}

Error response example

Description

For an unsuccessful request, Milesight Development Platform returns an HTTP 4xx or 500 status code, and the detailed error message that can help you to quickly address the error and modify the request.

Parameter Type Description
status String The result of a request.

In an error response, the status is Failed.

requestId String The unique ID of the request, which can be used to quickly locate the request.
errCode String The cause of the error.
errMsg String The detailed and specific information about the error.
Example

The example below shows an error response of requesting an access token with invalid authorization credentials.

HTTP/1.1 401 Unauthorized
{
    "status": "Failed",
    "requestId": "7bc8257ddaac3e87321f11221960d0f9",
    "errCode": "authentication_failed",
    "errMsg": "Bad credentials"
}