Example of HTTP return results
After the Platform API interface calling, HTTP will use status code and the standard JSON format to return the result. The specific error can be determined by the error field in the return data.
- HTTP status return code 200 (success)
- HTTP status return code 4xx (Request Error). These status codes indicate that the request may have error and interfere the processing of server.
- HTTP status return code 5xx (Server Error) These status codes indicate that an internal error occurred while the server was attempting to process the request.
Return Example
It is recommended to do fault tolerance for the Platform API results called by APP’s own server side. For example, It should catch the exception returned by the interface calling, and the timeout errors should be retried. For system errors or errors after retries, they should be recorded in the system log and provide the alert to DevOps staff to do remedial measures, such as manual retransmission.
Index Error Status Code
Status Code | Description |
---|---|
400 | (Error request) The server does not understand the syntax of the request. |
401 | (Unauthorized) requests require authentication. For interfaces that require a token, the server may return this response. |
403 | (Forbidden) The server rejects the request. For group/chat room services, it represents that this call does not follow the correct operation logic of group/chat room, such as adding the member who is already in the group, or removing a member who does not exist in the chat room. |
404 | (Not found) The server could not find the interface to request. |
405 | (Wrong request method) Please follow the interface instructions on the official website of Chat and use the interface GET, POST and other request methods correctly. |
408 | (Request timeout) A timeout occurred while the server was waiting for the request. |
413 | (Request body is too large) If the request body is more than 5kb, please split it into smaller requests and retry. |
415 | The type of request body is not supported. |
429 | (Service unavailable) Requesting interface in a frequency which exceeds limit or exceed the community edition limit. Please contact business if needed. |
500 | (Internal server error) The server encountered an error and could not complete the request. |
501 | (Not yet implemented) The server does not have the function to complete the request. For example, the server may return this code if it cannot recognize the request method. |
502 | (Error Gateway) The server acts as a gateway or proxy and receives an invalid response from the uplink server. |
503 | (Server timeout) Service Unavailable. |
504 | (Gateway timeout) The server acts as a gateway or proxy and does not receive the request from the uplink server timely. |
Index Error result description
HTTP Status Code | Error | Error Description | Possible reasons |
---|---|---|---|
400 | invalid_grant | invalid username or password | User name or password input error |
400 | invalid_grant | "client_id does not match" | "client_id does not match" is the client_id input is incorrect. "client_secret does not match" is the client_secret input is incorrect. Please find the details of client_id and client_secret in the the corresponding application in management background. |
400 | json_parse | "Unexpected character ('=' (code 61)): was expecting a colon to separate field name and value\n at [Source: java.io.BufferedInputStream\@170e3f35; line: 1, column: 23]" | The request body does not follow the standard JSON format when sending the request, and the server cannot parse it correctly. |
400 | illegal_argument | "Entity user requires a property named username" | The user creation request body does not provide "username" |
400 | illegal_argument | "password or pin must provided" | The user creation request body does not provide "password" or provides a password but the value is null. |
400 | illegal_argument | "newpassword is required" | The request body to change the user's password does not provide the newpassword attribute |
400 | illegal_argument | "oldPassword is required" | This is caused by not adding the header of the administrator token, you need to add the argument of the administrator token to the header |
400 | illegal_argument | "group member username1 doesn't exist" | When adding groups in batch, the username of the new member to join the group does not exist. |
400 | illegal_argument | "this is an invalid request." | If the request is invalid, please check the url, header and body of the called interface to see if they meet the requirements of the called interface, you can use the curl command to test |
400 | illegal_argument | "from can't be empty" | from represents the sender of the message. If there is no field server will default to "from":"admin". If there is a from field but the value of the null string (""), the request fails, return 400 |
400 | illegal_argument | "target_type can only be 'users' or 'chatgroups' or 'chatrooms'" | target_type can only be 'users' or 'chatgroups' or 'chatrooms'. for other strings, the request fails and returns 400 |
400 | illegal_argument | "username [hxtest1@chat.com] is not legal" | he username used for registration is not legal, username (Chat user ID) rules can be found in [documentation] |
400 | illegal_argument | "This chatmessage request is not supported" | It may be because the incoming time format is not correct, the correct format is: YYYYMMDDHH. For example, to get the chat logs from 12:00 to 13:00 on June 30, 2021, set it like this: 2021063012 |
400 | illegal_argument | "illegal arguments: appkey: chat-demo#chatdemoui, time: 2021063012, maybe chat message history is expired or unstored" | Chat logs for the corresponding time have not been generated or have expired, and chat logs are currently saved for free for 3 days. |
400 | invalid_parameter | "some of [groupid] are not valid fields" | Modify group information currently only supports the modification of "group name", "group description", "group maximum number of people", this error is that the modifed parameters are not supported, such as modify grouppid. |
400 | required_property_not_found | "Entity user requires a property named username" | This is the caused by the username being reset not existing |
400 | duplicate_unique_property_exists | "Application null Entity user requires that property named username be unique, value of hxtest1 exists" | Registered username already exists, return 400. Note: In the situation of batch registration, if a call returns an ID which already exists, the other non-existent IDs registered in this call will not be registered, you need to remove the existing IDs from the array and call registration again |
401 | unauthorized | "registration is not open, please contact the app admin" | description of error_description is appkey used to authorize registration, you need header plus administrator token to have permission to register users. If add token, it returns 401. The token may be invalid, it is recommended to retrieve and retry. |
401 | unauthorized | "Unable to authenticate due to expired access token" | the token expiredor no token passed |
401 | auth_bad_access_token | "Unable to authenticate due to corrupt access token" | The token used to send the request was incorrect. Note: Not token expiration |
401 | auth_bad_access_token | "Unable to authenticate" | Invalid token, the format of the token is right, but the token is not generated by the system accepting the request, the system can not recognize the token |
403 | forbidden_op | "can not join this group, reason:user: hxtest1 already in group: 40659491815425\n" | Group additions return 403 indicating that the user is already in the group. |
403 | forbidden_op | "users [hxtest100] are not members of this group!" | when the group kicks people, returning 403 indicating that the kicked user is not in the group. |
403 | forbidden_op | "user: username1 doesn't exist in group: 40659491815425" | Transferring the ownership of a group returns 403. error_description stating that the user being transferred to is not a member of the group and the ownership cannot be transferred. |
403 | forbidden_op | "new owner and old owner are the same" | ransferring the ownership of a group returns 403. error_description indicates that the ownership transferation is already done. |
403 | forbidden_op | "forbidden operation on group owner!" | You cannot blacklist a group owner. |
403 | "can not join this group, reason:user %s has joined too many groups/chatroom!" | The number of users joining a group or chat room exceeds the maximum. | |
403 | "this appKey has create too many groups/chatrooms!" | The number of groups or chat rooms created under appkey to reach the maximum. | |
403 | Failure to call interface, because you didn't open audio and video value-added service | ||
404 | organization_application_not_found | "Could not find application for hx/hxdeo2 from URI: hx/hxdeo2/token" | hx/hxdeo2 this setting is incorrect or does not exist, or the baseurl group is set incorrectly (only for the vip cluster appkey), the correct one is orgname/appname, which the "#" of the appkey is replaced with "/". |
404 | service_resource_not_found | "Service resource not found" | The resource specified by the URL does not exist. the user related interface represents user does not exist, group related interface represents group does not exist, chat room related interface represents chat room does not exist. |
404 | service_resource_not_found | "Service resource not found" | The queried username does not exist. if the username exists in the user list, it is because there is dirty data, you can use uuid to replace username to delete the ID, and then use the username to create again. |
404 | The deleted username does not exist, if the username exists in the user list, it can be deleted using the user's uuid to replace username. | ||
404 | storage_object_not_found | "Failed to find chat message history download url for appkey: hx#hxdemo2, time: 2021063012" | There is no chat record for the corresponding time, if you are sure there is a chat record, please submit a work order to the Chat technical support team for confirmation. |
413 | Request Entity Too Large | "Request Entity Too Large" | The request body is too large, such as uploading a too large file; or sending a message when the message body is too large, the request body will cause a 413 error if it exceeds 5kb, and needs to be split into several smaller requests to retry. when use the length of the user message + extension field, please make sure the size of them is within 4k bytes. |
415 | web_application | "Unsupported Media Type" | The request body type is not supported, please check whether the header adds "Content-Type":"application/json", whether the body follow the standard JSON format, and then confirm whether there are parameters in the header that are not required by the interface, which can be discarded. |
429 | resource_limited | "You have exceeded the limit of the community edition. Please upgrade to the enterprise edition." | It represents that the community edition restriction is triggered, Community Edition Restriction Introduction . If you have opened the enterprise edition, please contact Chat Business to tackle it. |
429 | reach_limit | "This request has reached api limit" | If the number of interface calls per second is exceeded, increase the call interval or contact business to adjust the flow limit size, see Interface Flow Limit Criteria |
500 | no_full_text_index | "Entity 'user' with property named 'username' is not full text indexed. You cannot use the 'contains' operand on this field" | Username does not support full-text indexing and cannot operate "contain" for this field. |
500 | unsupported_service_operation | "Service operation not supported" | The request method is not supported by the URL of request. |
500 | web_application | "javax.ws.rs.WebApplicationException" | Wrong request, sent to an unprovided API |