Skip to main content
added 790 characters in body
Source Link
Neil McGuigan
  • 1.4k
  • 2
  • 10
  • 15

If the URL represents a resource that never existed return 404 Not Found

If the URL represents a resource that is an empty list return an empty list and 200 OK.

Example:

{
  total: 0,
  items: []
}

If the URL represents a resource that used to exist return 410 Gone.

Regarding Lego Stormtrooper's dialog:

Alien: Computer, please tell me all planets that humans inhabit. GET /planets?inhabitedBy=humans

Computer: 200 OK. 1{ resulttotal: found.1, Earthitems:[{name:'Earth'}] }

Alien: Computer, please tell me about Earth. GET /planets/earth

Computer: 200 OK. Earth{name:'Earth', -status: Mostly'Mostly Harmless.Harmless'}

Alien: Computer, please tell me about all planets humans inhabit, outside the asteroid belt. GET /planets?inhabitedBy=humans&distanceFromSun=lots

Computer: 200 OK. {total:0, resultsitems:[] found.}

Alien: Computer, please destroy Earth. DELETE /planets/earth

Computer: 204 No Content. (or 202 Accepted if it takes some time to destroy Earth)

Alien: Computer, please tell me about Earth. GET /planets/earth

Computer: 410 Gone

Alien: Computer, please tell me all planets that humans inhabit. GET /planets?inhabitedBy=humans

Computer: 200 OK 0 results{total: found.0, items:[] }

Alien: Victory for the mighty Irken Empire!

If the URL represents a resource that never existed return 404 Not Found

If the URL represents a resource that is an empty list return an empty list and 200 OK.

Example:

{
  total: 0,
  items: []
}

If the URL represents a resource that used to exist return 410 Gone.

Regarding Lego Stormtrooper's dialog:

Alien: Computer, please tell me all planets that humans inhabit.

Computer: 200 OK. 1 result found. Earth

Alien: Computer, please tell me about Earth.

Computer: 200 OK. Earth - Mostly Harmless.

Alien: Computer, please tell me about all planets humans inhabit, outside the asteroid belt.

Computer: 200 OK. 0 results found.

Alien: Computer, please destroy Earth.

Computer: 204 No Content. (or 202 Accepted if it takes some time to destroy Earth)

Alien: Computer, please tell me about Earth.

Computer: 410 Gone

Alien: Computer, please tell me all planets that humans inhabit.

Computer: 200 OK 0 results found.

Alien: Victory for the mighty Irken Empire!

If the URL represents a resource that never existed return 404 Not Found

If the URL represents a resource that is an empty list return an empty list and 200 OK.

Example:

{
  total: 0,
  items: []
}

If the URL represents a resource that used to exist return 410 Gone.

Regarding Lego Stormtrooper's dialog:

Alien: Computer, please tell me all planets that humans inhabit. GET /planets?inhabitedBy=humans

Computer: 200 OK. { total: 1, items:[{name:'Earth'}] }

Alien: Computer, please tell me about Earth. GET /planets/earth

Computer: 200 OK. {name:'Earth', status: 'Mostly Harmless'}

Alien: Computer, please tell me about all planets humans inhabit, outside the asteroid belt. GET /planets?inhabitedBy=humans&distanceFromSun=lots

Computer: 200 OK. {total:0, items:[] }

Alien: Computer, please destroy Earth. DELETE /planets/earth

Computer: 204 No Content. (or 202 Accepted if it takes some time to destroy Earth)

Alien: Computer, please tell me about Earth. GET /planets/earth

Computer: 410 Gone

Alien: Computer, please tell me all planets that humans inhabit. GET /planets?inhabitedBy=humans

Computer: 200 OK 0 {total: 0, items:[] }

Alien: Victory for the mighty Irken Empire!
added 790 characters in body
Source Link
Neil McGuigan
  • 1.4k
  • 2
  • 10
  • 15

If the URL represents a resource that never existed return 404 Not Found

If the URL represents a resource that is an empty list return an empty list and 200 OK.

Example:

{
  total: 0,
  items: []
}

If it'sthe URL represents a resource that useused to exist, but doesn't anymore, return 410 Gone.

Regarding Lego Stormtrooper's dialog:

Alien: Computer, please tell me all planets that humans inhabit.

Computer: 200 OK. 1 result found. Earth

Alien: Computer, please tell me about Earth.

Computer: 200 OK. Earth - Mostly Harmless.

Alien: Computer, please tell me about all planets humans inhabit, outside the asteroid belt.

Computer: 200 OK. 0 results found.

Alien: Computer, please destroy Earth.

Computer: 204 No Content. (or 202 Accepted if it takes some time to destroy Earth)

Alien: Computer, please tell me about Earth.

Computer: 410 Gone

Alien: Computer, please tell me all planets that humans inhabit.

Computer: 200 OK 0 results found.

Alien: Victory for the mighty Irken Empire!

If the URL represents a resource that never existed return 404 Not Found

If the URL represents a resource that is an empty list return an empty list and 200 OK

If it's resource that use to exist, but doesn't anymore, return 410 Gone

If the URL represents a resource that never existed return 404 Not Found

If the URL represents a resource that is an empty list return an empty list and 200 OK.

Example:

{
  total: 0,
  items: []
}

If the URL represents a resource that used to exist return 410 Gone.

Regarding Lego Stormtrooper's dialog:

Alien: Computer, please tell me all planets that humans inhabit.

Computer: 200 OK. 1 result found. Earth

Alien: Computer, please tell me about Earth.

Computer: 200 OK. Earth - Mostly Harmless.

Alien: Computer, please tell me about all planets humans inhabit, outside the asteroid belt.

Computer: 200 OK. 0 results found.

Alien: Computer, please destroy Earth.

Computer: 204 No Content. (or 202 Accepted if it takes some time to destroy Earth)

Alien: Computer, please tell me about Earth.

Computer: 410 Gone

Alien: Computer, please tell me all planets that humans inhabit.

Computer: 200 OK 0 results found.

Alien: Victory for the mighty Irken Empire!
Source Link
Neil McGuigan
  • 1.4k
  • 2
  • 10
  • 15

If the URL represents a resource that never existed return 404 Not Found

If the URL represents a resource that is an empty list return an empty list and 200 OK

If it's resource that use to exist, but doesn't anymore, return 410 Gone