-
Notifications
You must be signed in to change notification settings - Fork 30
Limited Success Response #557
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
Conversation
Schema to be used across the APIs for consistent response structure in cases where request is successful (e.g. syntactically) but result is partially complete.
Introducing the section 2.3 for Limited Success Responses
|
I wonder if other code from Successful Response codes can be used to distinguish limited success from ample success response directly on the response level. Common scenarios for other codes are:
For me 202 Accepted looks better, although it is used in CAMARA for asynchronous responses Using other code than 200 would allow to keep the current definition of 200 response consistent across all APIs. |
|
I am not sure if section 2.3 is the best place for this guidelines. |
@rartych Status code 206, not sure how widely is used in the CAMARA APIs, but it implies there is more data, but again that's not the intent with the LimitedSuccessResponse. Also, each API defines its own 200 - responseBody. Introducing an alternative with the 'oneOf' wouldn't be a breaking change and if we agree there is wide applicability, then Design Guide may suggest inclusion of it across the APIs. |
It was just a suggestion. We can certainly include in a different section as you suggest. |
|
Given the proposal seems to manage scenarios where there is a limitation based on contextual or operational factors (e.g., device unreachable, not processable etc.), I wonder which is the rationale under considering them as success scenarios and not error ones managed by a HTTP 422 code, due to the fact that the request is understood by the server but not proccessable by any means. In that way, there have been similar scenarios like location-verification where this case is being managed by an error case (e.g. 422 "LOCATION_VERIFICATION.UNABLE_TO_LOCATE") In that way, we could define a set of transversal error CODE for these kind of scenarios. At the end of the day I have these doubts:
|
|
Hi @PedroDiez RFC 9110 states "The 4xx (Client Error) class of status code indicates that the client seems to have." Therefore, it can equally be misleading to respond with 4xx code in cases like these. I agree that using the The reasoning for 'non-breaking change' claim is, proposed approach is semantically backward compatible - it preserves the existing 200 response and behavior while adding an alternative response. That said, this change is expected to be introduced as a minor version change (via release cycle), and that will flag to client the new version has schema change. If it is more appropriate to mark as 'introduces breaking change', I can update the PR template accordingly. |
|
I can think of two categories of 'limited success' in API fulfillment: requests that apply to a single resource, and requests to collections. For a single resource:
For a collection:
In each case, the request has been received, understood, processed and responded to. Which makes it a |
|
Some more thougts from my side.
|
|
Regarding scenarios:
|
I share @PedroDiez's point of view. |
|
@PedroDiez Thank you for clarification. I agree that 422 can be used for the case when succesful response can not be delivered due to external conditions.
Probably we can add a section in chapter 3 Error Responses to have it documented. |
|
A couple of points from my side: Many CAMARA APIs currently handle "edge" cases—where a request is valid but cannot be fully fulfilled—using custom or inconsistent response structures. For example:
Adopting a standardized payload for these "limited success" responses would enable predictable client handling, reduce documentation-dependent logic (e.g., statusInfo required when status is OperationNotCompleted), and simplify SDK development. Regarding the use of 422: In cases like Location_Verification.Unable_to_locate, the request is syntactically and semantically correct, but the operation cannot be fulfilled. According to RFC 9110, 422 is for "unable to process the contained instructions," but here, the issue is not with the request itself. Returning a client error may not be ideal—instead, a 200 response with a standardized limited-success payload would better communicate the outcome to API consumers. Standardizing these responses would make the APIs more developer-friendly and consistent across the CAMARA ecosystem. |
|
HI @gmuratk
These both look like examples of valid requests which cannot be fulfilled (so 'no success' instead of 'limited success'). Consider instead this example of limited success from population-density-data:
For your second point:
I agree: referring to my comment here, this is a service exception. I believe a good way to distinguish between client error and service exception is that a request with a client error will always fail if repeated - which may or may not be the case with a service exception such as |
|
Thanks @Kevsy, I wanted to show precedence in the APIs that there are cases where limited or no success cases are responded with 200 status, and it will be best if we can define a standard structure to communicate limited or no success cases, without taking away the option for providers to respond with a 'service exception' as it is done today. |
|
Thanks @gmuratk , understood. The use of HTTP status codes to indicate API success (or not) is tricky because HTTP completion is not the same as API fulfillment. Especially the scope of the word 'success': as the RFC says, "The 200 (OK) status code indicates that the request has succeeded", but 'request' in that sentence simply means the HTTP request - not the API request.
Yes, I think that's important. |
| #### 2.3.5. Examples | ||
|
|
||
| **A) Normal Success (roaming status available):** | ||
| ```json | ||
| { | ||
| "roaming": true, | ||
| "countryCode": 208, | ||
| "countryName": ["FR"] | ||
| } | ||
| ``` | ||
|
|
||
| **B) Limited Success (device not connected):** | ||
| ```json | ||
| { | ||
| "status": 200, | ||
| "code": "subject-context", | ||
| "message": "NotConnected" | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is out of date, as the roaming API now returns a lastStatusTime field indicating when the roaming status was last confirmed correct. So even if the device is currently not connected to a mobile network, a historical status can still be returned.
If the API provider genuinely has no idea as to the roaming status (maybe they don't maintain any history for the device), then the agreed error is 503. This scenario is not even a partial success.
So an alternative example is required. Or the example should be removed.
|
Obsoleted by #567 |
What type of PR is this?
What this PR does / why we need it:
The current CAMARA API Design Guide does not explicitly define or standardize handling for limited success response cases (informative 2xx responses). These responses represent successful operations with partial fulfillment due to factors such as user preferences or temporary subject unavailability.
As a result, CAMARA APIs currently adopt inconsistent patterns when reporting scenarios like privacy control limitations or subject context restrictions. This inconsistency complicates both client implementation and interoperability across APIs that need to express partial but valid outcomes.
Which issue(s) this PR fixes:
Fixes #555
Does this PR introduce a breaking change?
Special notes for reviewers:
Changelog input
Additional documentation
This section can be blank.