Files
What you'll learn
- Design URLs as resources, a collection and its items, with no verbs in the path
- Choose between POST, PUT, PATCH and DELETE by what each one means
- Explain which methods are safe and which are idempotent, and why a client may retry the idempotent ones
Press Run tests to start the app. Its log appears here.Graded endpoints
The two cats the app starts with, colours included
POST adds to the collection and the server picks the id: 201, the stored cat, and a Location naming it
POST is not idempotent: the same request a second time creates a second cat
204 No Content: done, and nothing to say
DELETE is idempotent: the cat stays gone. The answer differs, the server's state does not
The item route agrees the cat is gone
PUT stores the body as the whole cat: Tom's colour was not sent, so it is gone
PATCH changes only what it carries: Luna's colour stays
PUT names the URL, so it can create there: 201 and a Location
PUT is idempotent: sending it twice leaves one Oliver, now replaced rather than created
The cat a PUT created is an item like any other
Id 4 was deleted and 7 was chosen by a PUT: the next id is one more than the highest in use, never a reused one
Every change above, and nothing else: one Milo, one Oliver, Tom without a colour
There is nothing to change