Skip to content

GSN‐SERVICES‐API documentation

manuelbcr edited this page Jul 25, 2024 · 2 revisions

Description

The basic documentation on Methods,Endpoints,Parameters and Descriptions can be found here.

Test Download Script for sensor data

A written test script for testing the API can be found here. This script is used to retrieve sensor data from a specific source, format it into a pandas DataFrame. It involves OAuth 2.0 authentication to access the data source.

Parameters for retrieving data from the API:

Parameter Description Example
size amount of data retrieved from the API. Currently the limit is set to 500.000 entries. 'size':'500' (returns 500 table entries)
fields selected fields to be retrieved from the API. 'fields': 'generation_time,device_id,target_id'
filter filter functionality for different fields. 'filter': 'light>30,light<60' or 'position=91'
timeFormat date and time format used in from and to fields. 'timeFormat': 'iso8601'
timeline newly created parameter to define the timeline for payload request using 'from' and 'to' (default is timed) timeline: 'generation_time'
from start point of data acquisition. (by default timed is the point looked at) 'from': '2023-01-01'
to end point of data acquisition. (by default timed is the point looked at) 'to': '2023-12-31'
fromTimestamp newly created start point of data acquisition in milliseconds. only timed possible 'fromTimestamp': '1708415112520'
toTimestamp end point of data acquisition in milliseconds. only timed possible 'toTimestamp': '1708415112520'
period returns a period of time for each year within the range, allowing for easy filtering of data based on time intervals (not tested) 'period': '01/15-02/15'
orderBy newly created parameter to define how the queried data from the DB should be ordered. (default is timed when size is given) 'orderBy': 'generation_time'
order newly created parameter to define the order (default order is 'desc' when no order is given) 'order': 'asc'
format output format of the data 'format': 'csv'

Permission Management in the API:

External clients (management scripts, websites,...)

  • External clients can be managed in the External clients management interface in the webserivces at: **/ws/oauth2/client **

  • Because the whole processing chain of data acquisition is based on gsn users, external clients have to be linked to a user in order to be able to retrieve data. If an external client has no linked user, no download is possible. But you can also use the Password grant authentication for data acquisition. An example script with username and password can also be found here

User management

  • The linked users can be managed in /ws/access/users (You need to have admin rights to do that).

Virtual sensor management:

  • Virtual sensors can be managed in /ws/access/vs. Here, read and write rights can be given to specific users.
  • If a user has no read rights for a specific sensor, all different data acquisition requests are not possible.
  • The sensor can be put to Publicly visible in order to also retrieve data.