wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

API for accessing lists of document references as subresources #28

Open mitar opened 11 years ago

mitar commented 11 years ago

API for accessing lists of document references as subresources. Currently only access to lists of embedded documents is possible.

mitar commented 11 years ago

Is #21 connected to this issue?

mitar commented 11 years ago

Some initial work has been done. But main thing it is still missing: to be able to work with list of referenced documents through a subresouce. This means you would be able to add a new object to a list by POSTing to subresource list end-point (eg. POST /api/v1/resource/<id>/reflist/), getting a list of all objects (with limits applied) by doing GET (eg. GET /api/v1/resource/<id>/reflist/). And also deleting from a list (eg. DELETE /api/v1/resource/<id>/reflist/<refid>/).

But it is also a bit tricky in comparison with embedded list. Because while we want DELETE to work (to remove from the list), we do not want that referenced objects have two URIs. So for example, GET /api/v1/resource/<id>/reflist/<refid>/ should probably redirect to its main URI. POST/PUT/PATCH should probably fail (or redirect to main URI? would that mean that post succeeded?).