We have a resource collection in our API design that can be addressed in multiple ways. For example say these are books.
ISBN | ISSN | Color |
---|---|---|
Foo | 1 | 2 |
Bar | 4 | 5 |
Baz | 7 | 8 |
The books can be addressed uniquely via ISBN, ISSN and the name and color are non-unique indexs as well. How can we model a REST API that allows PATCH operations on the books collection/items that can be specified in multiple ways?
For example we may wish the clients to address the books in any of the following ways
- by book name
- by book color
- by book ISBN
- by book name and color
How can I do this without creating multiple endpoints?
Aucun commentaire:
Enregistrer un commentaire