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

General api improvements #61

Open
6 tasks
adedw opened this issue Mar 22, 2023 · 0 comments
Open
6 tasks

General api improvements #61

adedw opened this issue Mar 22, 2023 · 0 comments
Assignees
Labels

Comments

@adedw
Copy link
Member

adedw commented Mar 22, 2023

  • Response body should be application/json, not text/plain;
  • Preferably return object due api consistency;
  • REST stands for Representational State Transfer, therefore return new state after create/update;
  • 201 status code for successfully created objects;
  • Include location header for created objects.
  • Payload should be in body for create/update.

example:

> POST <base-url>/api/v1/categories HTTP/1.1
> Content-Type: application/json
> Accept: application/json
> Authorization: Bearer <token>
>
> {
>     "categoryName": "Headsets"
> }

< HTTP/1.1 201 Created
< Content-Type: application/json
< Location: <base-url>/api/v1/categories/8d9830cc-2e15-42d7-a1c2-7b0c8b20d1b0
< <rest-headers>
<
< {
<     "uuid": "8d9830cc-2e15-42d7-a1c2-7b0c8b20d1b0",
<     "categoryName": "Headsets"
< }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

2 participants