URL structure
The resource URLs are, as much as possible, built up in such a way that every part of the URL has an independent meaning.
Using events as an example:
| Request | Explanation |
|---|---|
/events |
Doing GET on this will give you all events. Doing POST on this will create an event |
/events/1 |
Doing GET on this will give you event 1Doing PUT on this will update event 1Doing DELETE will delete event 1 |
/events/1/participants |
Doing GET on this will give you all participants of event 1Doing POST on this will create a new participant |
/events/1/participants/2 |
Doing GET on this will give you participant 2 of event1Doing PUT on this will update participant 2 of event 1Doing DELETE will delete the participant 2 of event 1 |
/events/1/participants/2/invoice |
Doing POST on this will send an invoice to participant 2 of event 1 |