Skip to content

Commit

Permalink
[change!] Changed API endpoints of geo app openwisp#460
Browse files Browse the repository at this point in the history
  • Loading branch information
ManishShah120 committed Jun 9, 2021
1 parent dbb64eb commit 5d14070
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
50 changes: 28 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,28 +164,6 @@ The geographic app is based on `django-loci <https://github.com/openwisp/django-
and allows to define the geographic coordinates of the devices,
as well as their indoor coordinates on floorplan images.

This module also provides an API through which mobile devices can update
their coordinates. See below for further details:

.. code-block:: text
GET /api/v1/device/{id}/location/
PUT /api/v1/device/{id}/location/
If a location has multiple devices, then the list of all such devices and related
information can be accessed via the following endpoint:

.. code-block:: text
GET /api/v1/location/{pk}/device/
To access all the locations that have devices deployed in them, use the following
endpoint, which provides a paginated list of such locations in GeoJSON format:

.. code-block:: text
GET /api/v1/location/geojson/
Settings
--------

Expand Down Expand Up @@ -796,6 +774,34 @@ Get command details
GET /api/v1/connection/device/{device_pk}/command/{command_pk}
Get device coordinates
^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: text
GET /api/v1/controller/device/{pk}/location/
Update device coordinates
^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: text
PUT /api/v1/controller/device/{pk}/location/
List of devices in a location
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: text
GET api/v1/controller/location/{pk}/device/
List locations with devices deployed (in GeoJSON format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: text
GET api/v1/controller/location/geojson/
List templates
^^^^^^^^^^^^^^

Expand Down
10 changes: 7 additions & 3 deletions openwisp_controller/geo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
def get_geo_urls(geo_views):
return [
path(
'api/v1/device/<str:pk>/location/',
'api/v1/controller/device/<str:pk>/location/',
geo_views.device_location,
name='device_location',
),
path('api/v1/location/geojson/', geo_views.geojson, name='location_geojson',),
path(
'api/v1/location/<str:pk>/device/',
'api/v1/controller/location/geojson/',
geo_views.geojson,
name='location_geojson',
),
path(
'api/v1/controller/location/<str:pk>/device/',
geo_views.location_device_list,
name='location_device_list',
),
Expand Down

0 comments on commit 5d14070

Please sign in to comment.