WattDepot logo WattDepot3 HTTP API: Sensors

GET /wattdepot/{group_id}/depositories

http://server.wattdepot.org/wattdepot/{group_id}/depositories Response
		      
[
  {
     "id": "ilima-energy1",
     "name": "Ilima energy consumption",
     "measurementType": "energy"
  },
  {
     "id": "lehua-energy1",
     "name": "Lehua energy consumption",
     "measurementType": "energy"
  },
  {
     "id": "uh-temp1",
     "name": "University of Hawaii Temperature",
     "measurementType": "temperature"
  }
]
		      
		    

Get a full list of defined WattDepositories.

GET /wattdepot/{group_id}/depository/{depository_id}

http://server.wattdepot.org/wattdepot/{group_id}/depository/ilima-energy1 Response
              
{
   "id": "ilima-energy1",
   "name": "Ilima energy consumption",
   "measurementType": "energy"
}
             
            

Get the WattDepository with the given depository_id.

GET /wattdepot/{group_id}/depository/{depository_id}/sensors/

http://server.wattdepot.org/wattdepot/{group_id}/depository/ilima-energy1/sensors/ Response
              
[
   {
      "id": "ilima-6-telco",
      "uri": "http://foo.com/ilima-6-telco",
      "location":
            {
               "description": "Hale Aloha Ilima residence hall 6th floor",
               "altitude": 30,
               "longitude": -157.812727,
               "latitude": 21.294642,
               "id": "ilima-6th"
            },
      "model":
            {
               "id": "egauge1.0",
               "protocol": "eGauge",
               "type": "EGAUGE",
               "version": "1.0"
            },
      []
   },
   {
      "id": "ilima-6-elect",
      "uri": "http://foo.com/ilima-6-elect",
      "location": 
            {
               "description": "Hale Aloha Ilima residence hall 6th floor",
               "altitude": 30,
               "longitude": -157.812727,
               "latitude": 21.294642,
               "id": "ilima-6th"
            },      
      "model":
            {
               "id": "egauge1.0",
               "protocol": "eGauge",
               "type": "EGAUGE",
               "version": "1.0"
            },
      []
   }
]
              
            

Get the list of Sensors that sent measurements to the WattDepository with the given depository_id.

GET /wattdepot/{group_id}/depository/{depository_id}/value/?sensor={sensor_id}&timestamp={timestamp}

http://server.wattdepot.org/wattdepot/{group_id}/depository/ilima-energy1/value/?sensor=ilima-6-telco&timestamp=2013-07-28T09:00:00.000-10:00 Response
              
{
  "sensorId": "ilima-6-telco",
  "value": 130531.388,
  "measurementType": "energy"
  "date":"2013-07-28T19:00:00.000+0000"
}
              
            

Get measurement value for the given sensor at the given time. This is most likely an interpolated value.

The request will return an error if the timestamp is less than the eariliest measurement time or greater than the latest measurement time.

GET /wattdepot/{group_id}/depository/{depository_id}/value/?sensor={sensor_id}&start={timestamp}&end={timestamp}

http://server.wattdepot.org/wattdepot/{group_id}/depository/ilima-energy1/value/?sensor=ilima-6-telco&start=2013-07-28T09:00:00.000-10:00&end=2013-07-29T09:00:00.000-10:00 Response
              
{
  "sensorId": "ilima-6-telco",
  "value": 372.84,
  "measurementType": "energy"
  "date": "2013-07-29T19:00:00.000+0000"
}
              
            

Get measurement value for the given sensor over the time period. The value at start is subtracted from the value at end. Note the date is the end of the period.

The request will return an error if the start or end timestamp is less than the eariliest measurement time or greater than the latest measurement time.

GET /wattdepot/{group_id}/depository/{depository_id}/measurements/?sensor={sensor_id}&start={timestamp}&end={timestamp}

http://server.wattdepot.org/wattdepot/{group_id}/depository/ilima-energy1/measurements/?sensor=ilima-6-telco&start=2013-07-28T09:00:00.000-10:00&end=2013-07-29T09:00:00.000-10:00 Response
              
[
  {
    "sensor":
      {
        "id": "ilima-6-telco",
        "uri":"http://foo.com",
        "location":
          {
            "id":"ilima-3",
            "latitude":21.294642,
            "longitude":-157.812727,
            "altitude":40.0,
            "description":"Hale Aloha Ilima residence hall 7th floor"
          },
        "model":
          {
            "id":"sm1",
            "protocol":"Hammer",
            "type":"hammer",
            "version":"1.0"
          }
        "properties":[]
      },
   "date": "2013-07-28T19:00:00.000+0000",
   "value": 372.84,
   "measurementType": "energy"
  },
  {
    "sensor":
      {
        "id": "ilima-6-telco",
        "uri":"http://foo.com",
        "location":
          {
            "id":"ilima-3",
            "latitude":21.294642,
            "longitude":-157.812727,
            "altitude":40.0,
            "description":"Hale Aloha Ilima residence hall 7th floor"
          },
        "model":
          {
            "id":"sm1",
            "protocol":"Hammer",
            "type":"hammer",
            "version":"1.0"
          }
        "properties":[]
      },
    "date": "2013-07-29T07:00:00.000+0000",
    "value": 492.75,
    "measurementType": "energy"
  },
  {
    "sensor":
      {
        "id": "ilima-6-telco",
        "uri":"http://foo.com",
        "location":
          {
            "id":"ilima-3",
            "latitude":21.294642,
            "longitude":-157.812727,
            "altitude":40.0,
            "description":"Hale Aloha Ilima residence hall 7th floor"
          },
        "model":
          {
            "id":"sm1",
            "protocol":"Hammer",
            "type":"hammer",
            "version":"1.0"
          }
        "properties":[]
      },
    "date": "2013-07-29T19:00:00.000+0000",
    "value": 406.92,
    "measurementType": "energy"
  }
]
              
            

Get measurements for the given sensor over the time period.

PUT /wattdepot/{group_id}/depository/

curl -X PUT -H "ContentType: application/json" -d '{"name": "Ilima energy consumption", "measurementType": "energy"}' http://server.wattdepot.org/wattdepot/{group_id}/depository/
              
{
   "status": 200,
   "message": "OK"
}
              
            

Add the WattDepository. Will return the HTTP status. Error status if duplicate unique id.

PUT /wattdepot/{group_id}/depository/{depository_id}/measurement/

curl -X PUT -H "ContentType: application/json" -d '{"sensorId": "ilima-6th-telco", "value": 793l4.54, "timestamp": "2013-07-28T09:02:00.000-10:00", "measurementType": "energy"}' http://server.wattdepot.org/wattdepot/{group_id}/depository/ilima-energy1/measurement/
              

              
            

Add the measurement to the given WattDepository. Will return the HTTP status. Error status if measurement type of the measurement doesn't match the WattDepositories measurement type.

DEL /wattdepot/{group_id}/depository/{depository_id}

curl -X DELETE http://server.wattdepot.org/wattdepot/{group_id}/depository/ilima-energy1
              
              
            

Deletes the WattDepository with the given depository_id. Will return the status. Error status if duplicate unique id.