-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardized problem types don't include all allowed Status Codes #36
Comments
In GitLab by @pvdbosch on Nov 13, 2019, 17:35 Hi Chrysoula, The idea is to use Problem JSON only when you can give additional information than provided by the HTTP status code. One could argue that, in general, the status codes you mentioned are explanatory enough. There may be specific use cases where additional information could be useful, which could be modeled as API-specific problem types. If there are some generic use cases you can think of that require additional info, we could yet consider to add them. A client should also not expect to always get a Problem JSON on every status code because reverse proxies or other middleboxes may generate HTTP errors outside control of the server application. @wsalembi, could you confirm that this was the reasoning followed in the working group? If so, I can add this explicitly to the guidelines. If not, we can bring this up again. Btw, optimistic locking for update/create scenarios with If(-None)-Match headers and status code 412 isn't well documented currently in our guidelines. Instead 409 is listed for updates with a failed optimistic locking. I'm creating another issue to followup on this. |
In GitLab by @wsalembi on Nov 14, 2019, 09:17 @pvdbosch My intention was to always return problem responses for any 4xx/5xx error status. Even if they just contain default fields, which brings a bit of consistency in any error returned by the API. The client applications can just inspect the problem response. We have a JAX-RS default exception mapper in the backends for that purpose and on gateway we have default problem definitions too. So +1 to standardize the missing status codes above. |
In GitLab by @pvdbosch on Nov 14, 2019, 11:58 An API Gateway or an Apache RP may also generate some of these error responses without a JSON Problem body, before arriving in the the application code. I'll add this issue to the agenda for next work group meeting. |
I agree that Problem types could be standardized for:
For 405 Method Not Allowed, 406 Not Acceptable, 415 Unsupported Media Type, I don't see much added value in standardizing the Problem types because they are self-explanatory and are most likely to be caused by programming errors and go unhandled by clients. In JAX-RS, an exception mapper could still create a Java Problem object even when the http response didn't have a body. |
At CBSS, we're using 502 - https://api.ksz-bcss.fgov.be/rest/problems/badGateway |
WG okayed adding problem types for 500 and 502. Other types in use by Smals that are not in REST guide:
Both seem OK to me to standardize in REST guide. Also validate with other members of WG. For other http codes 405,406,415 no WG participant had a specific use case to standardize them as problem types. For "409 Conflict", the use case is probably be dependent on business context (e.g. delete of a case refused because case is still open, action on a deceased person refused, ...). Better to define more specific problem types according to business context. Defining a generic type would discourage this. |
In fact, in the Rest Guide there is a standardized problem type for 429 Too Many Requests: |
The use case is probably that the server enforces quota per user on number of requests, and an additional lower quota on number of failed requests. |
created PR #66 to add the four new problem types |
I'll add problem types to guide: 429 gcloud.../problems/tooManyRequests |
PR #66 is ready for review |
add problem types payloadTooLarge, tooManyFailedRequests, internalServerError and badGateway
In GitLab by @smals-chlo on Nov 12, 2019, 16:21
In the Rest Guidelines, standardized problem types are defined for Status Codes 400, 401, 403, 404 & 429.
https://www.gcloud.belgium.be/rest/#standardized-problem-types
But some other allowed Status Codes could also be standardized: 405, 406, 412 & 415 as well as the 5XX error codes.
The text was updated successfully, but these errors were encountered: