Response Status Codes in oneM2M
When a oneM2M CSE processes a request, it returns a response to the client. The response contains a four-digit numerical status code that indicates the outcome of the request to the client. This could be a success, an error, or any other status that the client needs to know.
In case the status code indicates success, the response may also contain the requested data or any other information that the client requested. In case of an error, the response may contain additional information about the error, such as the error message or the error code.
m2m:dbg
A CSE might return additional information in case of an error. This could be an error message, an error code, or any other information that helps the client to understand the error. This information is included in the reponse content in the m2m:dbg element.
Example:
Common Response Status Codes
The following tables lists the most common status codes that a oneM2M CSE may return in response to a request. The tables are not exhaustive and may not contain all possible response status codes.
For a complete list, please refer to the oneM2M standard document TS-0004 - Service Layer Core Protocol.
Informational Status Codes
These response status codes are used to indicate that the request has been received and is being processed. They are usually used for asynchronous requests.
Status Code | Description | Comment |
---|---|---|
1000 | ACCEPTED | |
1001 | ACCEPTED | for nonBlockingRequestSynch |
1002 | ACCEPTED | for nonBlockingRequestAsynch |
Success Status Codes
These response status codes are used to indicate that the request has been successfully processed.
Status Code | Description | Comment |
---|---|---|
2000 | OK | General success status code |
2001 | CREATED | Resource created successfully |
2002 | DELETED | Resource deleted successfully |
2004 | UPDATED | Resource updated successfully |
Originator Error Response Status Codes
These response status codes are used to indicate that the request could not be processed due to an error in the request itself (i.e. the client made an error).
Status Code | Description | Comment |
---|---|---|
4000 | BAD_REQUEST | General error message |
4004 | NOT_FOUND | Target resource not found |
4005 | OPERATION_NOT_ALLOWED | Operation not allowed for target resource |
4008 | REQUEST_TIMEOUT | |
4015 | UNSUPPORTED_MEDIA_TYPE | CSE cannot process a request content |
4103 | ORIGINATOR_HAS_NO_PRIVILEGE | No privileges for the originator to run the operation |
4106 | ORIGINATOR_NOT_AUTHENTICATED | Unauthenticed originator |
4108 | INVALID_CHILD_RESOURCE_TYPE | Child resource not allowed for the target resource |
4117 | ORIGINATOR_HAS_ALREADY_REGISTERED |
Receiver Error Response Status Codes
These response status codes are used to indicate that the request could not be processed due to an error on the server side (i.e. the CSE made an error).
Status Code | Description | Comment |
---|---|---|
5000 | INTERNAL_SERVER_ERROR | General server error message |
5001 | NOT_IMPLEMENTED | Operation or feature not implemented by the CSE |
5103 | TARGET_NOT_REACHABLE | Target resource not reachable |
5105 | RECEIVER_HAS_NO_PRIVILEGE | No privileges for the receiver to run the operation |
5106 | ALREADY_EXISTS | Resource already exists |
5107 | REMOTE_ENTITY_NOT_REACHABLE | Remote entity / CSE not reachable |
5206 | NON_BLOCKING_SYNCH_REQUEST_NOT_SUPPORTED | Non-blocking synch requests are not supported by the CSE |
Network System Error Response Status Codes
These response status codes are used to indicate that the request could not be processed due to an error in the network system, i.e. via the Mcn interface.
Status Code | Description | Comment |
---|---|---|
6003 | EXTERNAL_OBJECT_NOT_REACHABLE | |
6005 | EXTERNAL_OBJECT_NOT_FOUND | |
6020 | MGMT_SESSION_CANNOT_BE_ESTABLISHED | |
6021 | MGMT_SESSION_ESTABLISHMENT_TIMEOUT |
Summary
This article described the most common response status codes that a oneM2M CSE may return in response to a request. The status codes indicate the outcome of the request and can be used by the client to determine the next steps to take. There are more specialized response status codes defined in the oneM2M standard, which can be found in the document TS-0004 - Service Layer Core Protocol.
by Andreas Kraft, 2024-04-06