56 lines
1.9 KiB
ReStructuredText
56 lines
1.9 KiB
ReStructuredText
Devices
|
|
#########
|
|
|
|
You can retrieve devices using ``GET /devices/``, or a specific
|
|
device by ``GET /devices/24``.
|
|
|
|
You can **filter** devices ``GET /devices/?filter={"type": "Computer"}``,
|
|
**sort** them ``GET /devices/?sort={"created": 1}``, and perform
|
|
natural search with ``GET /devices/?search=foo bar. Of course
|
|
you can combine them in the same query, returning devices that
|
|
only pass all conditions.
|
|
|
|
Results are **paginated**; you get up to 30 devices and up to 30
|
|
groups in a page. Select the actual page by ``GET /inventory?page=3``.
|
|
By default you get the page number ``1``.
|
|
|
|
Query
|
|
*****
|
|
The query consists of 4 optional params:
|
|
|
|
- **search**: Filters devices by performing a full-text search over their
|
|
physical properties, events, and tags. Search is a string.
|
|
- **filter**: Filters devices field-by-field. Each field can be
|
|
filtered in different ways, see them in
|
|
:class:`ereuse_devicehub.resources.devices.Filters`. Filter is
|
|
a JSON-encoded object whose keys are the filters. By default
|
|
is empty (no filter applied).
|
|
- **sort**: Sorts the devices. You can specify multiple sort clauses
|
|
as it is a JSON-encoded object whose keys are fields and values
|
|
are truthy for *ascending* order, or falsy for *descending* order.
|
|
By default it is sorted by ``Device.created`` descending (newest
|
|
devices first).
|
|
- **page**: A natural number that specifies the page to retrieve.
|
|
By default is ``1``; the first page.
|
|
|
|
Result
|
|
******
|
|
The result is a JSON object with the following fields:
|
|
|
|
- **devices**: A list of devices.
|
|
- **groups**: A list of groups.
|
|
- **widgets**: A dictionary of widgets.
|
|
- **pagination**: Pagination information:
|
|
|
|
- **page**: The page you requested in the ``page`` param of the query,
|
|
or ``1``.
|
|
- **perPage**: How many devices are in every page, fixed to ``30``.
|
|
- **total**: How many total devices passed the filters.
|
|
|
|
Models
|
|
******
|
|
|
|
.. automodule:: ereuse_devicehub.resources.device.models
|
|
:members:
|
|
:member-order: bysource
|