****************** Devices Management ****************** .. _provd-api-dev-mgr: Get the Device Manager ====================== The device manager links to the following resources: * The ``dev.synchronize`` relation links to the :ref:`device synchronization service `. * The ``dev.reconfigure`` relation links to the :ref:`device reconfiguration service `. * The ``dev.dhcpinfo`` relation links to the :ref:`device DHCP information service `. * The ``dev.devices`` relation links to the :ref:`list of devices `. Query ----- .. code-block:: http GET /provd/dev_mgr Example request --------------- .. code-block:: http GET /provd/dev_mgr HTTP/1.1 Host: wazoserver Accept: application/vnd.proformatique.provd+json Example response ---------------- .. code-block:: http HTTP/1.1 200 OK Content-Type: application/vnd.proformatique.provd+json { "links": [ { "href": "/provd/dev_mgr/synchronize", "rel": "dev.synchronize" }, { "href": "/provd/dev_mgr/reconfigure", "rel": "dev.reconfigure" }, { "href": "/provd/dev_mgr/dhcpinfo", "rel": "dev.dhcpinfo" }, { "href": "/provd/dev_mgr/devices", "rel": "dev.devices" } ] } .. _provd-api-dev-devices: List Devices ============ Query ----- .. code-block:: http GET /provd/dev_mgr/devices .. _provd-api-list-devices-parameters: Query Parameters ---------------- +----------+------------------------------------------------------------------------------------------+ | Field | Description | +==========+==========================================================================================+ | q | A selector, encoded in JSON, describing which device should be returned. All devices are | | | returned if not specified. Example: ``q={"ip":"10.34.1.119"}`` | +----------+------------------------------------------------------------------------------------------+ | fields | A list of fields, separated by comma. Example: ``fields=mac,ip`` | +----------+------------------------------------------------------------------------------------------+ | skip | An integer specifing the number of devices to skip. Example: ``skip=10`` | +----------+------------------------------------------------------------------------------------------+ | sort | The key on which to sort the results. Example: ``sort=id`` | +----------+------------------------------------------------------------------------------------------+ | sort_ord | The order of sort; either ``ASC`` or ``DESC``. | +----------+------------------------------------------------------------------------------------------+ Example request --------------- .. code-block:: http GET /provd/dev_mgr/devices HTTP/1.1 Host: wazoserver Accept: application/vnd.proformatique.provd+json Example response ---------------- .. code-block:: http HTTP/1.1 200 OK Content-Type: application/vnd.proformatique.provd+json { "devices": [ { "added": "auto", "config": "38e5e08ffe804b468f5aa53b9536bb25", "configured": true, "description": "", "id": "38e5e08ffe804b468f5aa53b9536bb25", "ip": "10.34.1.122", "mac": "00:08:5d:33:e5:76", "model": "6731i", "plugin": "xivo-aastra-3.3.1-SP2", "remote_state_sip_username": "je5qtq", "vendor": "Aastra", "version": "3.3.1.2235" } ] } Create a Device =============== Query ----- .. code-block:: http POST /provd/dev_mgr/devices Example request --------------- .. code-block:: http POST /provd/dev_mgr/devices HTTP/1.1 Host: wazoserver Content-Type: application/vnd.proformatique.provd+json { "device": { "ip": "192.168.1.1", "mac": "00:11:22:33:44:55", "plugin": "xivo-aastra-3.3.1-SP2" } } Example response ---------------- .. code-block:: http HTTP/1.1 201 Created Content-Type: application/vnd.proformatique.provd+json Location: /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271 {"id": "68b10c99945b4fb889f22a7559fc3271"} If the ``id`` field is not given, then an ID is automatically generated by the server. Get a Device ============ Query ----- .. code-block:: http GET /provd/dev_mgr/devices/ Example request --------------- .. code-block:: http GET /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271 HTTP/1.1 Host: wazoserver Accept: application/vnd.proformatique.provd+json Example response ---------------- .. code-block:: http HTTP/1.1 200 OK Content-Type: application/vnd.proformatique.provd+json { "device": { "added": "auto", "config": "38e5e08ffe804b468f5aa53b9536bb25", "configured": true, "description": "", "id": "38e5e08ffe804b468f5aa53b9536bb25", "ip": "10.34.1.122", "mac": "00:08:5d:33:e5:76", "model": "6731i", "plugin": "xivo-aastra-3.3.1-SP2", "remote_state_sip_username": "je5qtq", "vendor": "Aastra", "version": "3.3.1.2235" } } Update a Device =============== Query ----- .. code-block:: http PUT /provd/dev_mgr/devices/ Example request --------------- .. code-block:: http PUT /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271 HTTP/1.1 Host: wazoserver Content-Type: application/vnd.proformatique.provd+json { "device": { "added": "auto", "config": "38e5e08ffe804b468f5aa53b9536bb25", "configured": true, "description": "", "id": "38e5e08ffe804b468f5aa53b9536bb25", "ip": "10.34.1.122", "mac": "00:08:5d:33:e5:76", "model": "6731i", "plugin": "xivo-aastra-3.4", "remote_state_sip_username": "je5qtq", "vendor": "Aastra", "version": "3.3.1.2235" } } Example response ---------------- .. code-block:: http HTTP/1.1 204 No Content Delete a Device =============== Query ----- .. code-block:: http DELETE /provd/dev_mgr/devices/ Example request --------------- .. code-block:: http DELETE /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271 HTTP/1.1 Host: wazoserver Example response ---------------- .. code-block:: http HTTP/1.1 204 No Content .. _provd-api-dev-synchronize: Synchronize a Device ==================== Query ----- .. code-block:: http POST /provd/dev_mgr/synchronize Example request --------------- .. code-block:: http POST /provd/dev_mgr/synchronize HTTP/1.1 Host: wazoserver Content-Type: application/vnd.proformatique.provd+json { "id": "d035bccaf0dd4a8396fc57a3329ca0a4" } Example response ---------------- .. code-block:: http HTTP/1.1 201 Created Location: /provd/dev_mgr/synchronize/42 The URI returned in the ``Location`` header points to an :ref:`operation in progress ` resource. .. _provd-api-dev-reconfigure: Reconfigure a Device ==================== Query ----- .. code-block:: http POST /provd/dev_mgr/reconfigure Errors ------ +------------+------------------------+-----------------------------+ | Error code | Error message | Description | +============+========================+=============================+ | 400 | invalid device ID | | +------------+------------------------+-----------------------------+ Example request --------------- .. code-block:: http POST /provd/dev_mgr/reconfigure HTTP/1.1 Host: wazoserver Content-Type: application/vnd.proformatique.provd+json { "id": "d035bccaf0dd4a8396fc57a3329ca0a4" } Example response ---------------- .. code-block:: http HTTP/1.1 204 No Content .. _provd-api-dev-dhcpinfo: Push DHCP Request Information ============================= Query ----- .. code-block:: http POST /provd/dev_mgr/dhcpinfo Example request --------------- .. code-block:: http POST /provd/dev_mgr/dhcpinfo HTTP/1.1 Host: wazoserver Content-Type: application/vnd.proformatique.provd+json { "dhcp_info": { "ip": "192.168.1.100", "mac": "00:11:22:33:44:55", "op": "commit", "options": [ "06066.6f.6f.62.61.72.a" ] } } Example response ---------------- .. code-block:: http HTTP/1.1 204 No Content