差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
后一修订版 两侧同时换到之后的修订记录
im:other:errorcode:restapi [2018/12/25 09:25]
she
im:other:errorcode:restapi [2018/12/25 09:40]
she
行 2: 行 2:
  
 ---- ----
 +=====  HTTP 返回结果示例 ​ =====
 +REST 接口调用后,HTTP 会状态码以及标准 JSON 格式的返回结果。可根据返回数据中的 error 字段判断具体错误。
 +  * HTTP 状态返回代码 200(成功)
 +  * HTTP 状态返回代码 4xx(请求错误)这些状态代码表示请求可能出错,妨碍了服务器的处理。 ​
 +  * HTTP 状态返回代码 5xx(服务器错误)这些状态代码表示服务器在尝试处理请求时发生内部错误。
  
-REST 接口调用成功时返回 ​HTTP 状态码为 200,返回数据结果为标准 JSON 格式。如调用错误会返回除 200 之外的其他 HTTP 状态码,返回数据结果也为标准 JSON 格式,可根据返回数据中的 error 字段判断具体错误。 +===返回例 ===
- +
-如: ​+
  
 {{:​start:​450errorcode:​response_icon.jpg?​nolink|REST API返回错误示例}} {{:​start:​450errorcode:​response_icon.jpg?​nolink|REST API返回错误示例}}
行 11: 行 14:
 建议对 APP 自己的服务器端调用的环信 REST API 结果做容错处理。比如要 catch 接口调用返回的异常,对于 timeout 这样的错误应该做重试。对于系统级别错误或重试后仍旧出错,应该记录到系统日志,并及时报警提示运维人员做补救措施,如人工补发。 建议对 APP 自己的服务器端调用的环信 REST API 结果做容错处理。比如要 catch 接口调用返回的异常,对于 timeout 这样的错误应该做重试。对于系统级别错误或重试后仍旧出错,应该记录到系统日志,并及时报警提示运维人员做补救措施,如人工补发。
  
-HTTP 状态返回代码 4xx(请求错误)这些状态表示请求可能出错,妨碍了服务器的处理。  +===== 索引 ​错误状态码=====
- +
-HTTP 状态返回代码 5xx(服务器错误)这些状态代码表示服务器在尝试处理请求时发生内部错误。+
  
 ^HTTP 返回码(Status Code) ^说明(Description)^ ^HTTP 返回码(Status Code) ^说明(Description)^
行 29: 行 30:
 |503|(服务器超时)Service Unavailable。| |503|(服务器超时)Service Unavailable。|
 |504|(网关超时)服务器作为网关或代理,但是没有及时从上游服务器收到请求。| |504|(网关超时)服务器作为网关或代理,但是没有及时从上游服务器收到请求。|
 +
 +=====索引 错误结果说明 =====
  
 ^HTTP Status Code ^Error ^Error Description ^可能原因^ ^HTTP Status Code ^Error ^Error Description ^可能原因^
行 42: 行 45:
 |400|illegal_argument|"​from can't be empty" |from表示消息发送者,无此字段Server会默认设置为"​from":"​admin"​,有from字段但值为空字符串(""​)时请求失败,返回400| |400|illegal_argument|"​from can't be empty" |from表示消息发送者,无此字段Server会默认设置为"​from":"​admin"​,有from字段但值为空字符串(""​)时请求失败,返回400|
 |400|illegal_argument|"​target_type can only be '​users'​ or '​chatgroups'​ or '​chatrooms'"​ |target_type只能为'​users'​ or '​chatgroups'​ or '​chatrooms'​,为其他字符串时请求失败,返回400 | |400|illegal_argument|"​target_type can only be '​users'​ or '​chatgroups'​ or '​chatrooms'"​ |target_type只能为'​users'​ or '​chatgroups'​ or '​chatrooms'​,为其他字符串时请求失败,返回400 |
-|400|illegal_argument|"​username [hxtest1@easemob.com] is not legal"​|注册使用的username不合法,username(环信ID)规则文档|+|400|illegal_argument|"​username [hxtest1@easemob.com] is not legal"​|注册使用的username不合法,username(环信ID)规则见[[http://​docs.easemob.com/​im/​server/​ready/​user|文档]]|
 |400|illegal_argument|"​This chatmessage request is not supported"​|可能是传入的时间格式不正确,正确的格式是:YYYYMMDDHH,如要获取2018年02月09日12点到13点的聊天记录,这样设置:2018020912| |400|illegal_argument|"​This chatmessage request is not supported"​|可能是传入的时间格式不正确,正确的格式是:YYYYMMDDHH,如要获取2018年02月09日12点到13点的聊天记录,这样设置:2018020912|
 |400|illegal_argument|"​illegal arguments: appkey: easemob-demo#​chatdemoui,​ time: 2018020918, maybe chat message history is expired or unstored"​|对应时间的聊天记录还未生成或已过期,目前聊天记录免费保存3天。| |400|illegal_argument|"​illegal arguments: appkey: easemob-demo#​chatdemoui,​ time: 2018020918, maybe chat message history is expired or unstored"​|对应时间的聊天记录还未生成或已过期,目前聊天记录免费保存3天。|
行 57: 行 60:
 |403|forbidden_op|"​new owner and old owner are the same"​|转让群组返回403,error_description说明被转让的用户已经是群主。| |403|forbidden_op|"​new owner and old owner are the same"​|转让群组返回403,error_description说明被转让的用户已经是群主。|
 |403|forbidden_op|"​forbidden operation on group owner!"​|不能将群主加入黑名单。| |403|forbidden_op|"​forbidden operation on group owner!"​|不能将群主加入黑名单。|
-|403| |"can not join this group, reason:user %s has joined too many groups/​chatroom!"​|用户加入群组或聊天室数超过了限制。| +|403||"​can not join this group, reason:user %s has joined too many groups/​chatroom!"​|用户加入群组或聊天室数超过了限制。| 
-|403| |"this appKey has create too many groups/​chatrooms!"​|appkey下创建的群组或聊天室数量以达到限制。|+|403||"​this appKey has create too many groups/​chatrooms!"​|appkey下创建的群组或聊天室数量以达到限制。|
 |404|organization_application_not_found|"​Could not find application for hx/hxdeo2 from URI: hx/​hxdeo2/​token"​|hx/​hxdeo2这个设置不正确或不存在,或baseurl集群设置错误(只针对vip集群的appkey),正确的是orgname/​appname,即appkey的"#"​换成"/"​;| |404|organization_application_not_found|"​Could not find application for hx/hxdeo2 from URI: hx/​hxdeo2/​token"​|hx/​hxdeo2这个设置不正确或不存在,或baseurl集群设置错误(只针对vip集群的appkey),正确的是orgname/​appname,即appkey的"#"​换成"/"​;|
 |404|service_resource_not_found|“Service resource not found” |URL指定的资源不存在,如用户相关接口是用户不存在,群组相关接口是群组不存在,聊天室相关接口是聊天室不存在 | |404|service_resource_not_found|“Service resource not found” |URL指定的资源不存在,如用户相关接口是用户不存在,群组相关接口是群组不存在,聊天室相关接口是聊天室不存在 |
行 66: 行 69:
 |413|Request Entity Too Large|“Request Entity Too Large” |请求体过大,如上传文件时文件过大;或发送消息时消息体过大,请求体如果超过5kb会导致413错误,需要拆成几个更小的请求体重试,同时用户消息+扩展字段的长度在40k字节以内 | |413|Request Entity Too Large|“Request Entity Too Large” |请求体过大,如上传文件时文件过大;或发送消息时消息体过大,请求体如果超过5kb会导致413错误,需要拆成几个更小的请求体重试,同时用户消息+扩展字段的长度在40k字节以内 |
 |415|web_application|"​Unsupported Media Type" |请求体的类型不支持,请检查header是否添加"​Content-Type":"​application/​json"​,body是否符合标准的JSON格式,再确认header中是否还有非接口需要的参数,可以舍去| |415|web_application|"​Unsupported Media Type" |请求体的类型不支持,请检查header是否添加"​Content-Type":"​application/​json"​,body是否符合标准的JSON格式,再确认header中是否还有非接口需要的参数,可以舍去|
-|429|resource_limited|"​You have exceeded the limit of the community edition. Please upgrade to the enterprise edition."​ |说明触发了社区版限制,如您已开通企业版,请联系环信商务处理| +|429|resource_limited|"​You have exceeded the limit of the community edition. Please upgrade to the enterprise edition."​ |说明触发了社区版限制,[[http://​www.easemob.com/​pricing/​im|社区版限制介绍]],如您已开通企业版,请联系环信商务处理| 
-|429|reach_limit|"​This request has reached api limit" |超过接口每秒调用次数,加大调用间隔或者联系商务调整限流大小|+|429|reach_limit|"​This request has reached api limit" |超过接口每秒调用次数,加大调用间隔或者联系商务调整限流大小,见[[http://​docs.easemob.com/​im/​other/​errorcode/​restastrict|接口限流标准]]|
 |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不支持全文索引,不可以对该字段进行contains操作| |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不支持全文索引,不可以对该字段进行contains操作|
 |500|unsupported_service_operation|“Service operation not supported” |请求方式不被发送请求的URL支持| |500|unsupported_service_operation|“Service operation not supported” |请求方式不被发送请求的URL支持|