RE: "slight change in output" First of all define what it really means. What needs to be changed and how.
RE " is it a good idea to use same URL for both and serve by checking user type" Yes and No. It depends on your mentality. I personally prefer to have separate endpoints for different types of users, so if I change something for one user, I dont have to check if its still working for the other user or not. I would create different apps for different types of users. And each app would contain the endpoints for that particular user type. This is the best way I know. Other way to do this, is to update the core GET, POST, PUT, Patch, etc methods of the django/rest framework and return a diff response by checking the user type. e.g. If you are overwriting the Update View in django rest framework, you could overwrite the update method and check the user type after perform_update() was called. And return a different response by checking the user type. It will work. I hope it helps :) Cheers! On Monday, June 3, 2019 at 4:04:53 PM UTC+5:30, Harsh Gundecha wrote: > > what is recommended practice for serving same object to multiple types of > users with slight change in output > for e.g book object or issued book object to lets say staff and students, > is it a good idea to use same URL for both and serve by checking user type > PS: its a JSON based rest API in rest framework > > Thank you > Regards, Harsh > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2fe1099c-7341-4a4d-be9e-a420463f1595%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.