Timeline for Rest API design - ids as string
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 9, 2020 at 17:15 | comment | added | Robert Bräutigam |
@Nsevens Yes, if you would choose this URI, you would have to make sure the server doesn't assign archive as a document id. I would choose something outside of the /docs prefix frankly, but it is still quite possible and as I said, there are no hard rules against it. As the client should receive all URIs from the server it is irrelevant for the client, or in worst case it can check for it too.
|
|
Jan 9, 2020 at 16:03 | comment | added | Nsevens |
But in that case /docs/archive could indicate either the action to archive something, or a document with id archive ? The chance of that being an actual id are quite low, but still...
|
|
Jan 9, 2020 at 16:00 | comment | added | Robert Bräutigam |
@Nsevens JimmyJames is right, the URIs should be normally nouns (things). What exactly they are is irrelevant. Can be POST /docs/archiveOptions , /docs/archive , /docsarchive , /docs/archive/active . Again, it could be anything, there are no rules against any URIs. It may however indicate poor style and that some behind-the-scenes concepts may not be followed properly.
|
|
Jan 9, 2020 at 15:51 | comment | added | JimmyJames |
@Nsevens I think what Robert is saying is that you the URI should be a noun, not a verb. The verbs are your operations (PUT , POST , GET , etc.) The simple solution is you add another level to your path e.g. POST '/docs/archive/active'. The framework should be able to distinguish between the two paths.
|
|
Jan 9, 2020 at 15:43 | comment | added | Nsevens |
findAll was indeed a bad example; consider for example a /docs/archiveActive action, which archives all active documents I have access to
|
|
Jan 9, 2020 at 15:35 | history | edited | Robert Bräutigam | CC BY-SA 4.0 |
added 4 characters in body
|
Jan 9, 2020 at 15:29 | history | answered | Robert Bräutigam | CC BY-SA 4.0 |