Structure
The API is implemented via the django rest framework.
Using viewsets, most models are serialized and presented at the
/api/ endpoint. There a browseable API is presented but also in
json format (depending on the requested content-type or if .json is
appended).
Viewsets can be very simple, but also quite extendable. If needed, a lower-level approach could also be taken. However, it is recommended to use viewsets and other higher abstractions as much as possible to keep the paths consistent.
Currently, we have the following paths for different models:
{
"inventoryidschema": "/api/inventoryidschema/",
"tag": "/api/tag/",
"datatype": "/api/datatype/",
"locationdata": "/api/locationdata/",
"itemdata": "/api/itemdata/",
"productdata": "/api/productdata/",
"overlay": "/api/overlay/",
"overlayitem": "/api/overlayitem/",
"entity": "/api/entity/",
"location": "/api/location/",
"productinventoryid": "/api/productinventoryid/",
"product": "/api/product/",
"iteminventoryid": "/api/iteminventoryid/",
"item": "/api/item/"
}
The API supports both reading and writing. Items can be listed and created through GET and POST, obtaining details, updating and deletion of can be done trough GET, PUT, PATH, and DELETE http requests. For now, please refer to the drf documentation on making requests and on generic viewsets.
A openapi compatible schema description can be generated using
$ python manage.py generateschema --format openapi > schema.yml