Skip to content
kvavliak edited this page Jul 11, 2012 · 5 revisions

RESTful protocol for for Consumption Models.

The following Foreign Key apply:

cons_models.app_id : Foreign Key to Appliances

READ Scenarios

GET /api/consmod?app_id={app_id} | index

Fetches the ids and names of all the Consumption Models in the appliance defined using the query parameter app_id.

Consumes: Route, Parameter

Produces: JSON

{ "success": true, "message": "Consumption Models retrieved successfully", "size": 1, "data": [ { "_id": { "$oid": "4ffd693ee4b06b7b2983ed4a" }, "name": "Consumption Model 1", "description": "I am a Consumption Model ", "app_id": "4ff5bca7e4b0082c63d08df9", "model": { "n": 2, "params": { "n": 3, "values": [ { "p": 100, "d": 10, "s": 0 }, { "p": 120, "d": 5, "s": 0 } ] } } } ] }

READ Consumption Models

GET /api/consmod/{consmod_id} | show

Fetches all the the names, types and ids of the Consumption Models included in the given Appliance.

Consumes: Route

Produces: JSON

UPDATE Consumption Models

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

Updates the properties of the Consumption Model after editing.

Consumes: Route, JSON

Produces: JSON

DELETE Consumption Model

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

Deletes the Consumption Model with the given id.

Consumes: Route

Produces: JSON with delete status

CREATE Consumption Model

POST /api/consmod | create

Consumes: Route, JSON

{ name: "Consumption Model 1", description: "I am a Consumption Model ", app_id : "4ff5bca7e4b0082c63d08df9", model : { n : 222, params : { n : 3, values : [ {p : 100, d : 10, s: 0}, {p : 120, d : 5, s: 0 } ] } }

}

Clone this wiki locally