Project

General

Profile

APIs » History » Version 3

Version 2 (Philippe May, 05/04/2021 11:35) → Version 3/11 (Philippe May, 05/04/2021 11:40)

h1. APIs

Gisaf's web interface uses server's APIs, that can also be used for third party software integration, eg. for retrieving data from the database with HTTP requests.

The APIs use 2 technologies: json REST stores and Graphql.

This page is a work-in-progress documentation effort. Refer to source code for a comprehensive and up to date API list and usage:

* https://redmine.auroville.org.in/projects/gisaf/repository/revisions/master/entry/gisaf/api.py
* https://redmine.auroville.org.in/projects/gisaf/repository/revisions/master/entry/gisaf/graphql_api.py

It's also easy to track the HTTP requests in use by the web site, using standard web development tools like those embedded in all modern browsers.

h2. Json stores

h3. Getting record values from devices

For the custom models that define time-based values, eg. fetched from "IoT" enabled devices such as weather stations or other sensors, the generic HTTP request scheme is:

<pre>
<http_request_prefix>/api/<store>/values/<value>?<parameters>
</pre>

Where:

* http_request_prefix: base URI base of the site (eg. @https://gis.auroville.org.in@) "https://gis.auroville.org.in")
* store: name of the store of the geographical feature (eg. @avsm_misc.weather_station@) "avsm_misc.weather_station")
* value: name of the value for the store (eg. @temperature@) "temperature")
* parameters: URL-encoded query string, see below for details.

h4. Parameters

The parameters must be formatted with a URI-compliant query syntax.

Required:

* where: JSON encoded string specifying the id of the feature (eg. '{"avsm_misc.weather_station":4}')