Skip to content

General api improvements #61

Description

@adedw
  • 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"
< }

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions