A HTTP Status Codes and Applicability for Rerouting
This section describes the HTTP status codes usage on SBI. HTTP status codes are carried in the ":status" pseudo header field in HTTP/2, as defined in subclause 8.1.2.4 in IETF RFC 7540.
The following table specifies HTTP status codes per HTTP method that is supported on SBI. The support of the HTTP status code is:
- Mandatory, which is marked in table as "M". This signifies that all 3GPP NFs support the processing of the specific HTTP status code for the specific HTTP method, when received in a HTTP response message. In such cases, the 3GPP NF also supports the handling of the "ProblemDetails" JSON object with the Content-Type header field set to the value "application/problem+json" for HTTP status codes 4xx and 5xx if the corresponding API definition in the related technical specification does not specify another response body for the corresponding status code.
- Service specific, which is marked in table as "SS" and means that the requirement to process the HTTP status code depends on the definition of the specific API.
- Not applicable, which is marked in table as "N/A". This means that the specific HTTP status code shall not be used for the specific HTTP method within the 3GPP NFs.
- The Applicable for Rerouting column describes if the status code is applicable for rerouting at SCP. These status codes can be configured in routing options for each NF services.
NOTE 1: "200 OK" response used on SBI shall contain body.
NOTE 2: If the NF acting as an HTTP Client receives 2xx response code not appearing in table, the NF shall treat the received 2xx response: - as "204 No Content" if 2xx response does not contain body; and - as "200 OK" if 2xx response contains body.
HTTP Status Code Supported on SBI
Table A-1 HTTP Status Codes Supported on SBI as Defined in 3GPP TS29.500
HTTP Status Code | HTTP Method (DELETE) | HTTP Method (GET) | HTTP Method (PATCH) | HTTP Method (POST) | HTTP Method (PUT) | Applicable for Rerouting |
---|---|---|---|---|---|---|
100 Continue | N/A | N/A | N/A | N/A | N/A | No |
200 OK (NOTE 1) | SS | M | SS | SS | SS | No |
201 Created | N/A | N/A | N/A | SS | SS | No |
202 Accepted | SS | N/A | SS | SS | SS | No |
204 No Content (NOTE 2) | M | N/A | SS | SS | SS | No |
300 Multiple Choices | N/A | N/A | N/A | N/A | N/A | No |
303 See Other | SS | SS | N/A | SS | SS | Yes |
307 Temporary Redirect
307 (Should be included as part of 3xx) |
SS | SS | SS | SS | SS | Yes |
308 Permanent Redirect
308 (Should be included as part of 3xx) |
SS | SS | SS | SS | SS | Yes |
400 Bad Request | M | M | M | M | M | Yes |
401 Unauthorized | M | M | M | M | M | Yes |
403 Forbidden | SS | SS | SS | SS | SS | Yes |
404 Not Found | SS | SS | SS | SS | SS | Yes |
405 Method Not Allowed | SS | SS | SS | SS | SS | Yes |
406 Not Acceptable | N/A | N/A | N/A | N/A | N/A | Yes |
408 Request Timeout | SS | SS | SS | SS | SS | Yes |
409 Conflict
409 (should be included as part of "retriable-4xx" ) |
N/A | N/A | SS | SS | SS | Yes |
410 Gone | SS | SS | SS | SS | SS | Yes |
411 Length Required | N/A | N/A | M | M | M | Yes |
412 Precondition Failed | SS | SS | SS | SS | SS | Yes |
413 Payload Too Large | N/A | N/A | M | M | M | Yes |
414 URI Too Long | N/A | M | N/A | N/A | N/A | Yes |
415 Unsupported Media Type | N/A | N/A | M | M | M | Yes |
429 Too Many Requests | N/A | N/A | N/A | N/A | N/A | Yes |
500 Internal Server Error | M | M | M | M | M | Yes |
501 Not Implemented | SS | SS | SS | SS | SS | Yes |
502 Bad Gateway
502 (Should be included as part of gateway error and "5xx") |
SS | SS | SS | SS | SS | Yes |
503 Service Unavailable
503 (Should be included as part of "5xx") |
M | M | M | M | M | Yes |
504 Gateway Timeout
504 (Should be included as part of "5xx") |
SS | SS | SS | SS | SS | Yes |
Table A-2 Additional Status Codes Applicable for Reroute Condition List (reRouteConditionList)
HTTP Status Code | Applicable for Rerouting |
---|---|
301 Moved Permanently | Yes |
302 Found | Yes |
304 Not Modified | Yes |
407 Proxy Authentication Required | Yes |
416 Range Not Satisfiable | Yes |
417 Expectation Failed | Yes |
421 Misdirected Request | Yes |
422 Unprocessable Entity | Yes |
425 Too Early | Yes |
426 Upgrade Required | Yes |
428 Precondition Required | Yes |
431 Request Header Fields Too Large | Yes |
451 Unavailable For Legal Reasons | Yes |
505 HTTP Version Not Supported | Yes |
506 Variant Also Negotiates | Yes |
507 Insufficient Storage | Yes |
508 Loop Detected | Yes |
510 Not Extended | Yes |
511 Network Authentication Required | Yes |
5xx Server Errors | Yes |
NF as HTTP Client
Besides the HTTP Status Codes defined in the API specification, a NF as HTTP client should support handling of 1xx, 3xx, 4xx and 5xx HTTP Status Codes specified in above table, following the client behavior in corresponding IETF RFC where the received HTTP Status Code is defined.
When receiving a not recommended or not recognized 1xx, 3xx, 4xx or 5xx HTTP Status Code, a NF as HTTP client should treat it as x00 status code of the class, as described in clause 6 of IETF RFC 7231.
If 100, 200/204, 300, 400 or 500 response code is not defined by the API specification, the client may follow guidelines below:
- For 1xx (Informational):
- Discard the response and wait for final response.
- For 2xx (Successful):
- Consider the service operation is successful if no mandatory information is expected from the response payload in subsequent procedure.
- If mandatory information is expected from response payload in subsequent procedure, parse the payload following description in subclause 6.2.1 of IETF RFC 7231 [11]. If parse is successful and mandatory information is extracted, continue with subsequent procedure.
- Otherwise, consider service operation has failure and start failure handling.
- For 3xx (Redirection):
- Retry the request towards the directed resource referred in the Location header, using same request method.
- For 4xx (Client Error):
- Validate the request message and make correction before resending. Otherwise, stop process and go to error handling procedure.
- For 5xx (Server Error):
- Stop process and go to error handling process.
NF as HTTP Server
A NF acting as an HTTP server is able to generate HTTP status codes specified in above table per indicated HTTP method.
An HTTP method which is not supported by 5GC SBI API specification is rejected with the HTTP status code "501 Not Implemented".
NOTE 1: In this case, the NF does not need to include in the HTTP response the "cause" attribute indicating corresponding error since the HTTP status code "501 Not Implemented" itself provides enough information of the error, that is, the NF does not recognize the HTTP method.
If the specified target resource does not exist, the NF rejects the HTTP method with the HTTP status code "404 Not Found".
If the NF supports the HTTP method but not by a target resource, the NF rejects the HTTP method with the HTTP status code "405 Method Not Allowed" and includes in the response an Allow header field containing the supported method(s) for that resource.
NOTE 2: In this case, the NF does not need to include in the HTTP response the "cause" attribute indicating corresponding error since the HTTP status code "405 Method Not Allowed" itself provides enough information of the error and hence the Allow header field lists HTTP method(s) supported by the target resource.
If the received HTTP request contains incorrect optional IE, the NF discards the incorrect IE.
If the NF supports the HTTP method by a target resource but the NF cannot successfully fulfill the received request, the following requirements apply.
A NF as HTTP Server should map application errors to the most similar 3xx/4xx/5xx HTTP status code specified in table 5.2.7.1-1. If no such code is applicable, it should use "400 Bad Request" status code for errors caused by client side or "500 Server Internal Error" status code for errors caused on server side.
If the received HTTP request contains unsupported payload format, the NF rejects the HTTP request with the HTTP status code "415 Unsupported Media Type". If the HTTP PATCH method is rejected, the NF includes the Accept-Patch header field set to the value of supported patch document media types for a target resource i.e. to "application/merge-patch+json" if the NF supports "JSON Merge Patch" and to "application/json-patch+json" if the NF supports "JSON Patch". If the received HTTP PATCH request contains both "JSON Merge Patch" and "JSON Patch" documents and the NF supports only one of them, the NF ignores unsupported patch document.
NOTE 3: The format problem might be due to the request's indicated Content-Type or Content-Encoding header fields, or as a result of inspecting the payload body directly.
If the received HTTP request contains payload body larger than the NF is able to process, the NF rejects the HTTP request with the HTTP status code "413 Payload Too Large".
If the result of the received HTTP POST request used for a resource creation is equivalent to the existing resource, the NF rejects the HTTP request with the HTTP status code "303 See Other" and includes in the HTTP response a Location header field set to the URI of the existing resource.
Protocol and application errors common to several 5GC SBI API specifications for which the NF includes in the HTTP response a payload body ("ProblemDetails" data structure or application specific error data structure) with the "cause" attribute indicating corresponding error are listed in below table.
Table A-3 Protocol and Application Errors
Parameters | HTTP status code | Description |
---|---|---|
INVALID_API | 400 Bad Request | The HTTP request contains an unsupported API name or API version in the URI. |
INVALID_MSG_FORMAT | 400 Bad Request | The HTTP request has an invalid format. |
INVALID_QUERY_PARAM | 400 Bad Request | The HTTP request contains an unsupported query parameter in the URI. |
MANDATORY_IE_INCORRECT | 400 Bad Request | A mandatory IE or conditional IE in data structure, but mandatory required, for an HTTP method was received with a semantically incorrect value. (NOTE 1) |
MANDATORY_IE_MISSING | 400 Bad Request | IE which is defined as mandatory or as conditional in data structure, but mandatory required, for an HTTP method is not included in the payload body of the request. (NOTE 1) |
UNSPECIFIED_MSG_FAILURE | 400 Bad Request | The request is rejected due to unspecified client error. (NOTE 2) |
MODIFICATION_NOT_ALLOWED | 403 Forbidden | The request is rejected because the contained modification instructions attempt to modify IE which is not allowed to be modified. |
SUBSCRIPTION_NOT_FOUND | 404 Not Found | The request for modification or deletion of subscription is rejected because the subscription is not found in the NF. |
RESOURCE_URI_STRUCTURE_NOT_FOUND | 404 Not Found | The request is rejected because a fixed part after the first variable part of an "apiSpecificResourceUriPart" (as defined in subclause 4.4.1 of 3GPP TS 29.501) is not found in the NF. This fixed part of the URI may represent a sub-resource collection (e.g. contexts, subscriptions, policies) or a custom operation. (NOTE 5) |
INCORRECT_LENGTH | 411 Length Required | The request is rejected due to incorrect value of a Content-length header field. |
NF_CONGESTION_RISK | 429 Too Many Requests | The request is rejected due to excessive traffic which, if continued over time, may lead to (or may increase) an overload situation. |
INSUFFICIENT_RESOURCES | 500 Internal Server Error | The request is rejected due to insufficient resources. |
UNSPECIFIED_NF_FAILURE | 500 Internal Server Error | The request is rejected due to unspecified reason at the NF. (NOTE 3) |
SYSTEM_FAILURE | 500 Internal Server Error | The request is rejected due to generic error condition in the NF. |
NF_CONGESTION | 503 Service Unavailable | The NF experiences congestion and performs overload control, which does not allow the request to be processed. (NOTE 4) |
NOTE 1: "invalidParams" attribute is included in the "ProblemDetails" data structure indicating missing or incorrect IE.
NOTE 2: This application error indicates error in the HTTP request and there is no other application error value that can be used instead.
NOTE 3: This application error indicates error condition in the NF and there is no other application error value that can be used instead.
NOTE 4: If the reason for rejection is a temporary overload, the NF may include in the response a Retry-After header field to indicate how long the service is expected to be unavailable.
NOTE 5: If the request is rejected because of an error in the URI before the first variable part of "apiSpecificResourceUriPart", then the "404 Not Found" HTTP status code may be sent without the "ProblemDetails" data structure indicating protocol or application error.