Timeline for Url pattern for making a 'like' with a REST API
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 6, 2019 at 10:39 | comment | added | Taimoor Ahmad | Thanks Cormac. Indeed, I don't have a social aspect to my Django project, therefore there's no need for a user to be able to see other users' likes. Though I understand this limits me in the future if I wanted to add a social aspect to the project. | |
| Jun 6, 2019 at 10:19 | comment | added | Cormac Mulhall | Just bear in mind doing it like that means you don't have a unique URL for the resource, which may cause trouble at a later date (for example how can one user check if another user has liked an item). If your design is relatively simple this may not be an issue, but it highlights the problem when a resource does not have a unique URI | |
| Jun 5, 2019 at 21:13 | comment | added | Taimoor Ahmad | I decided to instead make it /recipes/id/like and /recipes/id/unlike both using PUT. With Django I can get the current user through request. Thank you! | |
| Jun 5, 2019 at 20:37 | comment | added | Taimoor Ahmad | Thank you, you are correct. I will make routes like: PUT /api/item/likes/[userid] DEL /api/item/likes/[userid] | |
| Jun 5, 2019 at 20:37 | vote | accept | Taimoor Ahmad | ||
| Jun 5, 2019 at 17:26 | comment | added | Robert Harvey | You're going to need at least an ItemID and a UserID. | |
| Jun 5, 2019 at 17:10 | history | answered | Cormac Mulhall | CC BY-SA 4.0 |