For anyone googling, I ended up using drf-nested-routers package to make this happen.
On Wednesday, December 13, 2017 at 6:14:58 PM UTC-5, Nicholas Serra wrote: > > Hello everyone, thanks for reading. > > I'm trying to find some examples to do a route like this: > > GET /labs/1/parameters > GET /labs/1/parameters/1 > > ... and so on... > > where theres full CRUD on both Lab endpoints and Parameter endpoints, and > where Parameter is looked up via two IDs in the url (lab ID and parameter > ID). Parameter has a FK to Lab. The idea being that the end user would > never get a list of Parameters without providing a Lab id, as the > application is multi tenant. > > Having a hard time finding anything. This doc looks close but having a > hard time getting it linked up: > http://www.django-rest-framework.org/api-guide/relations/#example_2 > > I'm also open to the idea that structuring routes like this is not the DRF > way, as I mostly see flat style endpoints. In that case, maybe some kind of > required filter for lab on a Parameters endpoint would suffice, but not > seeing much on docs around that either. I may just not know the best way to > describe this. > > Thanks in advance for any help :) > -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
