Response Format And Errors
Success
Versioning
We will maintain collections of existing fields as well as their format through
the complete lifecycle of version 1 of the API. However, the API is still in BETA
and from time to time we may need to extend existing endpoints by introduction of
new fields to keep them up to date with improvements to iHealth platform. Still,
keep in mind that best practice for your application's response parser would be
to stay loose and don't fail validation if it sees extra fields.
Response
When the response returns data in addition to a status code, the body contains the
data.
Status code:
|
200 OK (GET/POST requests)
|
Content-Type:
|
text/xml or application/json
|
Body:
|
Response in the format requested: JSON or XML
|
Response Body Format
JSON:
XML:
<?xml version="1.0" encoding="UTF-8"?>
< DownloadUserInfoDataEntity mlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
[data]
</DownloadUserInfoDataEntity>
Error
When an error occurs during the request, iHealth OpenAPI will return the error message
as the following:
Error: name of the error message
ErrorCode: error number
ErrorDescription: the detail description of this error message
{
"Error": "invalid_APIName",
"ErrorCode": 5004,
"ErrorDescription": "APIName is invalid"
}
The table below shows all the error messages:
Error Message
Error Code
|
Error
|
Error Description
|
0000
|
success
|
success.
|
0001
|
access_denied
|
The server refuses the client request.
|
0002
|
is_not_authorized
|
Unauthorized.
|
0003
|
SC_or_SV_is_not_authorized
|
Sc or sv is unauthorized.
|
1001
|
redirect_uri_mismatch
|
The request for redirected URL is mismatch.
|
1002
|
client_secret_mismatch
|
The key for the request is mismatch.
|
2001
|
unauthorized_client
|
Client is unauthorized.
|
2002
|
unauthorized_token
|
Token is Unauthorized.
|
2003
|
unauthorized_APIName
|
APIName is unauthorized.
|
2005
|
user_region_unavailable
|
user region is : api.ihealthlabs.com.cn
|
3001
|
unsupported_time_range
|
The start_time parameter is out of range.
|
3002
|
unsupported_user_id
|
User_id is not exist.
|
3003
|
unsupported_page_index
|
The page_index parameter is unsupported.
|
3004
|
unsupported_grant_type
|
The grant_type parameter? is unsupported.
|
3005
|
unsupported_response
|
The response is not unsupport.
|
3006
|
unsupported_response_type
|
The response_type parameter is not unsupport.
|
3007
|
invalid_user_id
|
User_id is invalid.
|
4001
|
expired_token
|
Token is expired.
|
4002
|
revoked_token
|
Token is revoked.
|
4003
|
unknown_token
|
Token is unknown.
|
4004
|
used_token
|
Token is used by others.
|
5001
|
invalid_client
|
Client_id is invalid.
|
5002
|
invalid_grant
|
AccessGrant is invalid.
|
5003
|
invalid_request
|
The required parameters is not enough.
|
5004
|
invalid_APIName
|
APIName is invalid.
|
5005
|
invalid_secret
|
The client_secret parameter is invalid.
|
5006
|
invalid_redirect_uri
|
invalid_redirect_uri.
|
5007
|
invalid_user
|
invalid_user.
|
5008
|
ip_user
|
Unauthorized users_ip.
|
5009
|
repeat_username
|
repeat_username.
|
200
|
out_of_range
|
Parameter out of range.
|
201
|
user_not_exist
|
The user does not exist.
|
503
|
limits_hour_error
|
Reached the one-hour access limit.
|