Skip to content
kvavliak edited this page Jul 9, 2012 · 7 revisions

RESTful protocol for Appliances

The following Foreign Key apply:

appliances.inst_id : Foreign Key to Installations

READ Appliances

GET /api/app?inst_id={inst_id} | index

Fetches the Appliances of an Installation using the query parameter inst_id.

Consumes: Route, Parameter

Produces: JSON

READ Appliance

GET /api/app/{app_id} | show

Fetches the properties of an appliance and other included entities i.e. ConsumptionModel.

Consumes: Route

Produces: JSON

{
  "_id": {
    "$oid": "4ff5bca7e4b0082c63d08df9"
  },
  "name": "Fridge",
  "description": "I am a Frige",
  "energy_class": "C",
  "standy_consumption": 4.43,
  "controllable": false,
  "shiftable": true,
  "inst_id": "4ff5bca7e4b0082c63d08df7"
}

] }

CREATE Appliance

POST /app | create

Consumes: Route, JSON:

{ name: "ApplianceName", type : "fridge", description: "I am an appliance", energy_class: "A", standy_consumption: 1.23, controllable: true, shiftable: false, inst_id: "4ff42978e4b0c906ef374ce2", consumptionModel : "{5{100.4;4;0.2;3},{20.5;3;1}};{1{40.2;2;0.3},{40.5;3;-1}}"

}

Produces: Create status

UPDATE Appliance

PUT /api/app/{app-id} | update

Updates the properties of the Appliance after editing.

Consumes: Route, JSON: same as in action show

Produces: Update status

DELETE Appliance

DELETE /api/app/{app-id} | delete

Deletes the existing Appliance. The Appliance is deleted from all the Installations referencing it as well.

Consumes: Route

Produces: Delete status

Clone this wiki locally