Thanks Rajesh. Taking a quick look at the book on Safari Bookshelf, I've drawn the conclusion that since filtering is an algorithmic type operation, it can legitimately be specified with query parameters.
I'm struggling to align this with REST's requirement to be hypertext driven [1], unless the parameters by which a resource list can be filtered are specified. I have ordered the full book though, so I guess I will find out... Matt. [1] http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven On Jul 2, 6:36 pm, Rajesh D <rajesh.dha...@gmail.com> wrote: > On Jul 2, 11:03 am, Matt <bennett.matt...@gmail.com> wrote: > > > > > Hi all, > > > I've started to use the django-rest-interface to build an API for a > > service that I'm working on. Principally all that's required is for a > > client to be able to create and update objects remotely via POST and > > PUT, but as this is the first REST interface I've built I'm trying to > > explore all the options. > > > The first problem I've come up against is the correct way to make > > queries. django-rest-interface allows you to build custom URLs, so > > for example "/json/polls/121/choices/2/" will return the second choice > > from poll #121. But building a custom URL for each query isn't very > > flexible and django-rest-api doesn't seem to have any dynamic way to > > provide them. This approach doesn't let you query on anything other > > than foreign key relationships either. > > > I thought about tacking some GET params onto a request and filtering > > the resulting queryset by them, but I've not come across any REST > > implementations that do this and I'm not sure if it's the correct > > thing to do. If I understand REST correctly then everything should be > > discoverable by URL and links, so perhaps querying has no place? That > > seems altogether too limited though. > > > Can someone clarify the principals for me, and suggest a way to > > perform queries RESTfully? > > Try O'Reilly's "RESTful Web Services" > book:http://oreilly.com/catalog/9780596529260/ > > It goes into great detail on the questions you pose above. Also, take > a look at how other successful REST APIs do it (say, Twitter) and > imitate them. > > There's nothing special about REST that you can't achieve with your > own custom views building off of request.method's possible values. So > if the django-rest-api is too limiting for you, make up for the > limitations with your own additional views. > > -RD --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---