Skip to content
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

Error and bulk responses #891

Open
johnzuk opened this issue Dec 5, 2023 · 5 comments
Open

Error and bulk responses #891

johnzuk opened this issue Dec 5, 2023 · 5 comments
Labels
Agency Specific to the Agency API documentation documentation change can be for code and/or markdown pages minor update A change that is minor and should require little discussion, or is a maintenance/readme/typo update.
Milestone

Comments

@johnzuk
Copy link

johnzuk commented Dec 5, 2023

I want to clarify bulk responses error http codes.

Let's assume i want process multiple vehicles through agency/vehicles endpoint - lets say 3 of them. Lets say first vehicle is already registered, second one has wrong type in filed device_id and third one is correct.
What should be api response and http code in that case? Should it be 409 or 400 or 201 and response like:

{
  "success": 1,
  "total": 3,
  "failures": [
  ... //all details here abut failures  
  ]
}
@schnuerle schnuerle added this to the 2.0.1 milestone Dec 7, 2023
@schnuerle
Copy link
Member

Going to tag @jiffyclub on this for a quick reply. Thanks!

@schnuerle schnuerle removed this from the 2.0.1 milestone Dec 18, 2023
@schnuerle schnuerle added Agency Specific to the Agency API documentation documentation change can be for code and/or markdown pages labels Dec 18, 2023
@jiffyclub
Copy link
Contributor

I personally think I would reject the whole batch if there was a failure and return an error code relevant to the first error I found. I would stop processing the batch at the first error and return that one.

@schnuerle schnuerle added this to the 2.1.0 milestone Feb 12, 2024
@schnuerle
Copy link
Member

Yes I agree with @jiffyclub. Stop at the first error and return that one. Is that standard behavior, or is a note needed in the spec to make this more clear?

@schnuerle
Copy link
Member

Let's decide on the behavior and wording change to the spec, and we can add this in 2.1.

@jiffyclub
Copy link
Contributor

Probably worth a note so we don't get too many wildly divergent implementations, but the most important part is setting an HTTP error code so the client knows something went wrong and look into it. As long as there's an error and the error message is useful the client can investigate.

@schnuerle schnuerle added the minor update A change that is minor and should require little discussion, or is a maintenance/readme/typo update. label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agency Specific to the Agency API documentation documentation change can be for code and/or markdown pages minor update A change that is minor and should require little discussion, or is a maintenance/readme/typo update.
Projects
None yet
Development

No branches or pull requests

3 participants