Developers

Download or upload sensor data programmatically

1. Quick start checklist


  API Token
Please contact us first and we will issue you a developer account and an API token


  Testing
If you are logged in (Check the top-right area of this page), your tokens will be used in the examples below to make testing easier.


  Uploading data
Contact us if you would like to puch data from other sensors to our dashboard.





2. Obtaining data from Pycno Sensors

  2.1 Introduction

The following basic requests allow a server or a mobile app to obtain sensor data directly from the Pycno server. HTTPS is mandatory for any sensitive information and it is highly recommended.

HTTPS endpoint https://portal.pycno.co.uk/api/v2/data (RECOMMENDED)

HTTP endpoint http://beta.pycno.co.uk/api/v2/data (HTTP POST, only for testing)


Under your account on the pycno dashboard you can see your token. With that token you can hit the /api/v2/data/* endpoints.

  2.2 Request format

  • Getting the list of sensors
    • Issue a GET request to the following link, and pass the token in the link params.
    • https://portal.pycno.co.uk/api/v2/data/nodelist.json?TK=TOKEN_HERE
    • The resulting array shows all the sensors under your farm.

  • Getting one sensor's info
    • If you have many sensors you can request only the information of one sensor, by doing the following.
    • Issue a GET request to the following link, and pass the token in the link params.
    • https://portal.pycno.co.uk/api/v2/data/no/M1234567890.json?TK=TOKEN_HERE
    • The resulting struct shows you the latest snapshot of all the sensor readings and some other data. You can also see at the bottom an array called PLOTTABLE.
    • An example is "plottable": ["TEMP", "HUM","LDR","SO_20T","SO_40T","ST", "BAT","RSSI"]
    • This array shows what useful data can be plotted. These are short codes for Temperature, Humidity, Solar radiation, Soil at 20 and 40cm, Soil temperature, battery voltage and Signal strength.
  • Getting timeseries data from a sensor
    • Issue a GET request to the following link. Pass the token, sensor ID as UID, the sensor type (BAT or TEMP, or any other key from the plottable list) and an optional date range in the link params.
    • https://portal.pycno.co.uk/api/v2/data/1?TK=TOKEN_HERE&UID=M1234567890&BAT&start=2017-01-10T22:10:29.140Z&end=2017-11-24T05:18:50.547Z
    • By changing the BAT to HUM you can get the humidity for the same period.
    • https://portal.pycno.co.uk/api/v2/data/1?TK=TOKEN_HERE&UID=M1234567890&HUM&start=2017-01-10T22:10:29.140Z&end=2017-11-24T05:18:50.547Z