Skip to content

papiNet should use best practice for status codes #287

@larsolofsson

Description

@larsolofsson

papiNet should review best practice for status codes and apply best practice.

My findings about best pratice for status codes

1 GET a list of items

  • When items found: 200 OK
  • When no items found: 200 OK with an empty collection (array)
  • 400 Bad request

Currently in 4.0.0

  • 200 OK
  • 204 No Content, (Not best practice when no items found)

2 Get details of an item

  • 200 OK
  • 404 Not Found
  • 400 Bad request

Currently in 4.0.0

  • 200 OK
  • 404 Not Found

3 Post when the client has defined "id": as a UUID and the server doesn't respond with a response body

  • 201 Created (with Location header, no body)
  • 409 Conflict (The UUID already exists)
  • 400 Bad request

Currently in 4.0.0

  • 200 OK
  • 400 Bad request

N.B. Best practice is to use PUT instead of POST to create an resource, when the client defines the "id": as a UUID

PUT to create an resource, when the client defines the "id": as a UUID and the server doesn't respond with a response body.

  • 201 Created (with Location header, body optional)
  • 400 Bad request

4 PUT when used to replace an existing resource and the server doesn't respond with a response body

  • 204 No Content
  • 400 Bad request

Currently in 4.0.0

  • 200 OK
  • 400 Bad request

Metadata

Metadata

Assignees

No one assigned

    Labels

    MUST BE DISCUSSEDMust be discussed during the next CWG meeting

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions