Skip to content
Api for automated garden
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Garden API

A simple AWS Serverless api for an automated garden. Uses Rollup for bundling and transpiling.


yarn install


yarn deploy


  • node
  • yarn
  • serverless + aws credentials


  • Create/List/Get Gardens
  • Post sensor data
  • Snapshot task
  • Alerts
  • Auto watering scheduling

Data Structures

Garden (object)

  • id: (string, required) unique hash to identify the garden
  • name: (string, required)
  • description: (string)
  • created: (integer, required) timestamp generated when created
  • snapshot: (Snapshot)

Garden Snapshot (object)

this is a snapshot of the state of the garden

  • gardenId: (string, required)
  • ts: (integer, required)
  • battery: (integer)
  • soilHumidity: (integer)

Sensor Data (object)

  • garden: (string, required) garden id hash
  • ts: (integer, requred) timestamp, generated by server not microcontroller
  • type: (string, required) sensor type. soilHumidity, temperature, etc
  • readings: (array[Sensor Reading], required)
  • battery: (integer|null) battery percentage, or null if not battery powered

Sensor Reading (object)

  • pin: (integer, required) corresponding pin in the microcontroller
  • raw: (any, required) raw contains the raw value reading, usually voltage.
  • calibrated: (any) calibrated is the interpreted form of the reading, for example the soil humidity percentage


Public endpoints

GET /gardens Returns a list of Garden items

GET /gardens/{id} Returns a Garden item, and an up to date snapshot of the garden state

    garden: Garden
    snapshot: Garden Snapshot

GET /gardens/{gardenId}/sensors/{type} Returns a dump of all the sensor data for that particular garden and type

Private endpoints

This endpoints require the header X-Api-Key: {secretKey}

POST /gardens creates a new Garden item request body

    name: (string, required) 
    description: (string)

response body

HTTP 200
{ Garden } 

POST /gardens/{gardenId}/sensors/{type} endpoint for the hardware at the garden to report updates regardless of the sensor type, the request includes the battery level, omit if not battery powered request body

    type: (string, required),
    readings: Array[Sensor Reading],
    battery: (integer), 


HTTP 200
You can’t perform that action at this time.