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

Use appropriate HTTP status codes in case of errors in the multisite_account.json API #224

Open
tanius opened this issue Oct 31, 2019 · 0 comments

Comments

@tanius
Copy link
Member

tanius commented Oct 31, 2019

Currently, the multisite account creation API multisite_account.json will provide a HTTP response with code "200 OK" in all cases, whether the request was successful or not. In the case of an unsuccessful request, the body will then contain an error message in JSON format.

However, in the core Discourse API the HTTP status codes are not 200 in case of an error (example). So we want to do it similarly. Proposal:

  • Use status code "403 Forbidden" in case the account could not be created because the username or e-mail address was already taken. That seems suitable because "403 […] may be due to the user not having the necessary permissions […] or attempting a prohibited action (e.g. creating a duplicate record where only one is allowed)." (source)

  • In other cases, use "400 Bad Request" if and where applicable.

Probably the implementation could just checking what status code the Discourse API used in the background sent back, and use that for the response to the client. Just as one with the forwarded JSON error message already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant