主页 > 开发 > IP控制 > REST API
错误代码
Estimated reading time: 7 minutes
在REST API协议中,使用HTTP和JSON-RPC,因此可以使用状态 两个层的代码。 本文档描述如何处理错误 不同的层,并列出主要错误的例子。
概述
- 错误代码定义在0-65535之间。错误代码分为两个区域(REST API系统区域和用户区域)。
error code | area |
---|---|
0 - 32767 | REST API system area |
32768 - 65535 | user area |
- The user area is divided between the common area and each service.
error code | area |
---|---|
32768 - 39999 | Unused areas. |
40000 - 40199 | Service common areas. |
40200 - 40399 | System service area. |
40400 - 40599 | Camera service area. |
40600 - 40799 | videoScreen service area. |
40800 - 40999 | Audio service area. |
41000 - 41199 | avContent service area. |
41200 - 41399 | Recording service area. |
41400 - 41599 | appControl service area. |
41600 - 41799 | Browser service area. |
42000 - 42199 | accessControl service. |
42200 - 42399 | contentDownload service. |
42400 - 42599 | Encryption service. |
42600 - 42799 | contentSync service. |
42800 - 42999 | contentSync service. |
43000 - 65535 | A reserved area. |
- 这是错误代码解释表的图例。
code | Reason phrase example | JSON example | Explanation |
---|---|---|---|
Error code. This is the 1st Element of “error”. | Example of the error reason message. This is the 2nd Element of “error”. | Example of the “error” member’s response. This is shown in bold and italics. | Explanation of the error case. |
REST API中的HTTP主要错误代码。
这是基本方针。
- 应该遵循原始的HTTP定义。
- 不应强行将他人映射到HTTP错误。
如果HTTP状态码不是200就可以了。 如果是HTTP服务器 根据REST API协议返回响应体, 错误代码必须与HTTP错误代码相同。 主要的错误代码 如下所示。
code | Reason phrase example | JSON example | Explanation |
---|---|---|---|
401 | Unauthorized | “error”: [401, “Unauthorized”] | Request requires user authentication. |
403 | Forbidden | “error”: [403, “Forbidden”] | Server understood the request, but is refusing to fulfill it. The client does not have permission to access. |
404 | Not Found | “error”: [404, “Not Found”] | For cases where the request is not matched to any supported API version. |
413 | Request Entity Too Large | “error”: [413, “Request Entity Too Large”] | The accepted body size of the client request exceeds the maximum limit. |
414 | Request-URI Too Long | “error”: [414, “Request-URI Too Long”] | The accepted URI length of the client request exceeds the maximum limit. |
501 | Not Implemented | “error”: [501, “Not Implemented”] | When the request method is not implemented on the server. |
503 | Service Unavailable | “error”: [503, “Service Unavailable”] | When the server is in a temporarily unavailable state which may occur due to other concurrent connections. (The number of maximum connections is not defined because it depends on the server.) |
System Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
1 | Any | “error”: [1, “Any”] | A generic error code which can be used with any error. |
2 | Timeout | “error”: [2, “Timeout”] | For cases when the server cannot reply in time. |
3 | Illegal Argument | “error”: [3, “Illegal Argument”] | For cases when the “params” value in the request does not follow API specifications. |
5 | Illegal Request | “error”: [5, “Illegal Request”] | For cases when the request body is empty, has no ID or has an invalid ID, has no method, has no params, or the params is not an array. |
7 | Illegal State | “error”: [7, “Illegal State”] | For cases when the server cannot handle the request at this time. |
12 | No Such Method | “error”: [12, “No Such Method”] | For cases when the requested API does not exist. |
14 | Unsupported Version | “error”: [14, “Unsupported Version”] | For cases when the requested version is not supported on the specified service. |
15 | Unsupported Operation | “error”: [15, “Unsupported Operation”] | For cases when the server cannot handle the request with respect to the specified parameters. |
Common Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
40000 | Request Retry | “error”: [40000, “Request Retry”] | Long Polling timeout happens. |
40001 | Client Over Maximum | “error”: [40001, “Clients Over Maximum”] | The number of Long Polling clients exceeds the maximum limit. |
40002 | Encryption Failed | “error”: [40002, “Encryption Failed”] | Encryption error. Failed to encrypt/decrypt in the encryption API. |
40003 | Request Duplicated | “error”: [40003, “Request Duplicated”] | Client must wait for the previous response. |
40004 | Multiple Settings Failed | “error”: [40004, “Multiple Settings Failed”] | One or more settings are not set by error when multiple settings are set. The client needs to call paired APIs (getXXXSettings) to identify which parameters failed to be updated. |
40005 | Display is turned off | “error”: [40005, “Display is turned off”] | Display is turned off. |
40006 | Please contact the inquiry counter | “error”: [40006, “Exxxx”] | A common error code used among services to be used for general errors. This error code can be used only to identify general errors, but has different messages (like error codes) in “error_message” just for debugging or display purposes. |
system Service Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
40200 | Password expired | “error”: [40200, “Password expired”] | Password is expired. |
40201 | AC power required | “error”: [40201, “AC power required”] | Server cannot run this method without AC power. |
videoScreen Service Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
40600 | Screen Change in Progress | “error”: [40600, “Screen Change in Progress”] | Another request is in progress. |
audio Service Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
40800 | Target Not Supported | “error”: [40800, “Target Not Supported”] | Target is not supported or cannot be controlled for some device specific reason. |
40801 | Volume Out of Range | “error”: [40801, “Volume Out of Range”] | Volume is out of range. |
avContent Service Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
41000 | Content is Protected | “error”: [41000, “Content is Protected”] | Content is protected. |
41001 | Content does Not Exist | “error”: [41001, “Content does Not Exist”] | Content does not exist. |
41002 | Storage has no content. | “error”: [41002, “Storage has no content.”] | Storage has no content. |
41003 | Some content could not be deleted | “error”: [41003, “Some content could not be deleted”] | Some content could not be deleted. |
41011 | Channel Fixed by USB Recording | “error”: [41011, “Channel Fixed by USB Recording”] | Channel is fixed by USB recording. |
41012 | Channel Fixed by SCART Recording | “error”: [41012, “Channel Fixed by SCART Recording”] | Channel is fixed by SCART recording. |
41013 | Chapter doesn’t exist | “error”: [41013, “Chapter doesn’t exist”] | Chapter doesn’t exist. |
41014 | Channel can’t be uniquely determind. | “error”: [41014, “Channel can’t be uniquely determind”] | Channel can’t be uniquely determined. |
41015 | Empty Channel list. | “error”: [41015, “Empty Channel list”] | Empty channel list. |
41020 | Storage doesn’t exist | “error”: [41020, “Storage doesn’t exist”] | Storage doesn’t exist. |
41021 | Storage is full | “error”: [41021, “Storage is full”] | Storage is full. |
41022 | Content attribute setting failed. | “error”: [41022, “Content attribute setting failed.”] | Content attribute setting failed. |
41023 | Unknown group id. | “error”: [41023, “Unknown group id.”] | Unknown group ID. |
41024 | Content is not supported. | “error”: [41024, “Unsupported content”] | Content is not supported. |
appControl Service Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
41400 | Another Request in Progress | “error”: [41400, “Another Request in Progress”] | Another request is in progress. |
41401 | Failed to Launch | “error”: [41401, “Failed to Launch”] | Failed to launch, for example, because another application is running. |
41402 | Request In Progress | “error”: [41402, “Request In Progress”] | Request is accepted, but completion of the application’s launch cannot be decided. |
41403 | Failed to Terminate | “error”: [41403, “Failed to Terminate”] | Some applications can’t be terminated. |
encryption Service Error Code
code | Reason phrase example | JSON Example | Explanation |
---|---|---|---|
42400 | Key doesn’t exist | “error”: [42400, “Key doesn’t exist”] | Key doesn’t exist yet. |
Last modified: 21 Feb 2019