evennia.web.api.urls

The Django Rest Framework provides a way of generating urls for different views that implement standard CRUD operations in a quick way, using ‘routers’ and ‘viewsets’. A viewset implements standard CRUD actions and any custom actions that you want, and then a router will automatically generate URLs based on the actions that it detects for a viewset. For example, below we create a DefaultRouter. We then register ObjectDBViewSet, a viewset for CRUD operations for ObjectDB instances, to the ‘objects’ base endpoint. That will generate a number of URLs like the following:

list objects: action: GET, url: /objects/, view name: object-list create object: action: POST, url: /objects/, view name: object-list retrieve object: action: GET, url: /objects/<:pk>, view name: object-detail update object: action: POST, url: /objects/<:pk>, view name: object-detail delete object: action: DELETE, url: /objects/<:pk>, view name: object-detail set attribute: action: POST, url: /objects/<:pk>/set-attribute, view name: object-set-attribute