This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/docs/lots.rst

30 lines
1008 B
ReStructuredText

Lots
####
Lots are folders that contain devices and other lots, and can be
at the same time under several lots.
`Here <https://www.bustawin.com/
dags-with-materialized-paths-using-postgres-ltree/>`_ you have
a low-level technical implementation of how lots and their
relationships are mapped.
Create lots
***********
You create a lot by ``POST /lots/`` a `JSON Lot object <https://
app.swaggerhub.com/apis/ereuse/devicehub/0.2/#model-Lot>`_.
Adding / removing children
**************************
You can add lots to a lot by performing
``POST /lots/<parent-lot-id>/children/?id=<child-lot-1>&id=<child-lot-2>``.
Note that all lots must exist before. The **parent** lot is the
lot containing the **children** lots without any intermediate lot.
To remove children lots the idea is the same:
``DELETE /lots/<parent-lot-id>/children/?id=<child-lot-1>&id=<child-lot-2>``.
And for devices is all the same:
``POST /lots/<parent-lot-id>/devices/?id=<device-id-1>&id=<device-id-2>``;
idem for removing devices.