API Access

API Endpoint
 https://exosilva.ch/api/

If you feel ready, jump directly on the technical documentation using the link at the top of the page. Otherwise, you can follow the gentle introduction to the SilvAPI on this page. while reading this page, don't hesitate to try the examples provided in the technical documentation.

Authentication

The API authentication will use the username and password registered in the ExoSilva plateform. If you're not registered yet, you will need to create an account before using the API. Credentials are sent to the server encrypted over SSL, as well as the token delivered. A token will be valid for a period of 24 hours.
The number of calls send to the API is currently limited to 20 per day for free account plans. If want more freedom, don't hesite to contact the team!

Example using python

This snippet contains more than what's necessary to authenticate yourself to the SilvAPI. Username and password are sent to the API in the data payload of a POST request. Once the credentials validated, the server will simply respond with a token contained in the JSON request.

import requests
base_url = 'https://exosilva.ch/api'
url = base_url + '/auth'
data = {'username': 'USERNAME',
        'password': 'PASSWORD'}
response = requests.post(url=url, data=data)

if response.status_code != 200:
    print('An error occured')
    print(response.status_code)
    print(response.content)
    
else:
    print('Authentication token successfully retrieved')
    token = response.json()['token']

Additional examples are displayed in the technical documentation.

Data request

Let's start by seing an example of data request. Use the authentication snippet to get your token before replicating the example. We request here the smoothed NDVI values retrieved using the full archive of ExoSilva at the coordinate east 2576889m and north 1261156m (EPSG: 2056).

import json
headers = dict()
headers['Authorization'] = 'Bearer {}'.format(token)
headers['Content-Type'] = 'application/json'

url = base_url + '/data/smoothed/VHI?east=2576889&north=1261156'
response = requests.get(url, headers=headers)
if response.status_code == 200:
    json_data = response.json()
    print(json.dumps(json_data, indent=4, sort_keys=False))
else:
    print(response.text)
    print(response.status_code)

Examples of answer can be visualized in the technical documentation.

Route request

To simplify the access to all data available in ExoSilva and to discover additional dataset, various query will return dictionary of route access. The generic query to get a list of all data route is given in the next example. It is a simple query on the /api/data route of SilvAPI.

headers = dict()
headers['Authorization'] = 'Bearer {}'.format(token)
headers['Content-Type'] = 'application/json'

url = base_url + '/data'
response = requests.get(url, headers=headers)
if response.status_code == 200:
    json_data = response.json()
    print(json.dumps(json_data, indent=4, sort_keys=False))
else:
    print(response.text)
    print(response.status_code)]

Services

We can set up new services in ExoSilva for your needs or develop a tailor-made piece of software just for you! In case you would like to explore possibilites, contact us freely!

Notifications

Registration to notifications are currently not available through SilvAPI. Also, there is currently no possiblity to request notifications states or alert trough SilvAPI.