HTTP Status Code and applicability for rerouting

Description

HTTP status code supported on SBI

NF as HTTP Client

NF as HTTP Server

This page describes the HTTP status codes usage on SBI. HTTP status codes are carried in ":status" pseudo header field in HTTP/2, as defined in subclause 8.1.2.4 in IETF RFC 7540.

Below table specifies HTTP status codes per HTTP method which is supported on SBI. Support of an HTTP status code is:

  • mandatory, which is marked in table as "M". This means that all 3GPP NFs shall 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; or
  • 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.
  • "Applicable for Rerouting" column describes if the status code is applicable for rerouting at SPF. These Status codes can be configured in Routing options for each NF services.

Table 4-5 HTTP status code supported on SBI

HTTP status code HTTP status code

HTTP method

Applicable for Rerouting
DELETE GET PATCH POST PUT
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 NO
307 Temporary Redirect SS SS SS SS SS Yes 307 (Should be included as part of 3xx)
308 Permanent Redirect SS SS SS SS SS Yes 308 (Should be included as part of 3xx)
400 Bad Request M M M M M No
401 Unauthorized M M M M M No
403 Forbidden SS SS SS SS SS No
404 Not Found SS SS SS SS SS Yes 404
405 Method Not Allowed SS SS SS SS SS No
406 Not Acceptable N/A N/A N/A N/A N/A No
408 Request Timeout SS SS SS SS SS Yes 408
409 Conflict N/A N/A SS SS SS Yes 409 (should be included as part of "retriable-4xx" )
410 Gone SS SS SS SS SS Yes 410
411 Length Required N/A N/A M M M No
412 Precondition Failed SS SS SS SS SS No
413 Payload Too Large N/A N/A M M M No
414 URI Too Long N/A M N/A N/A N/A No
415 Unsupported Media Type N/A N/A M M M No
500 Internal Server Error M M M M M Yes 500
501 Not Implemented SS SS SS SS SS Yes 501
503 Service Unavailable M M M M M Yes 503 (Should be included as part of "5xx")
504 Gateway Timeout SS SS SS SS SS Yes 504 (Should be included as part of "5xx")

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.

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.

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, i.e. 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 fulfil 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 would be 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 4-6 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 X)
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 X: If the request is rejected because of an error in an URI before the first variable part of an "apiSpecificResourceUriPart", the "404 Not Found" HTTP status code may be sent without "ProblemDetails" data structure indicating protocol or application error.