Archived 22.11.20. Content moved to error scenarios and responses.
Question
I would like to clarify what the exact error code should be for the following scenarios:
-
When the
x-v
header is missing from the request -
When a negative value or a decimal value (1.2) is sent for
x-v
orx-min-v
headers
What error response payload is required?
Answer
The x-v
endpoint version header is mandatory. See CDS HTTP Headers.
If a mandatory header is missing then a 400 Bad Request error is suitable.
400 Bad Request
Request has malformed, missing or non-compliant JSON body or URL parameters
If an unsupported version is requested, such as a negative or non-integer value, then a 406 Not Acceptable error is suitable.
406 Not Acceptable
The request contained an Accept header other than permitted media types, a character set other than UTF-8 or a version that was not supported
For the 400
and 406
responses, the standard does not specify an error payload, and none is required. The implementer can supply a custom payload. See CDS HTTP Response Codes.
Specifying a Custom Payload
Where no error payload is specified in the standard, the implementer is free to return a null payload, or include information in the payload as desired.
If the implementer chooses to supply a custom payload, it must follow the format specified in CDS Response Payload Structure.
For each unique code
value, the title
field must be consistent.
See:
Comments
2 comments
An update on issue 164 provided a different answer for negative and non-integer versions.
Nils thanks for the call out; we need to update this Knowledge Article.
EDIT: I have updated the article with a warning this is under review.
Please sign in to leave a comment.