-
Notifications
You must be signed in to change notification settings - Fork 0
RESTful protocol
This page specifies the RESTful protocol between the client and server applications of the CASSANDRA platform.
The conventions for writing the protocol will be:
[RESTful route] | [action]
To better present the protocol we have separated it by the entities involved as seen below:
There is no id in the RESTful routes for the ConsumptionModel since there is a 1 to 1 relationship between the ConsumptionModel and the Appliance. The JSON data include just a vector of number defining the consumption model.
/{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | GET /{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | show
Fetches the properties of the ConsumptionModel for visualization purposes.
/{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod/new | GET /{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod/new | new
Prepares for editing a new ConsumptionModel. Can be though as of loading an empty ConsumptionModel (empty form).
/{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod/edit | GET /{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod/edit | edit
Fetches the properties of the ConsumptionModel for editing.
All read ops:
Consumes: Route
Produces: JSON
/{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | POST /{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | create
Creates a new consumption model for the given Appliance, based on the properties filled up by the user when creating a new ConsumptionModel.
Consumes: Route, JSON
Produces: Create status
/{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | PUT /{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | update
Updates the properties of the ConsumptionModel after editing.
Consumes: Route, JSON
Produces: Update status
/{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | DELETE /{usrnm}/prj/{prj-id}/scn/{scn-id}/app/{app-id}/cnsmod | delete
Deletes the existing ConsumptionModel.
Consumes: Route
Produces: Delete status
Entity containing the simulation parameters of the scenario i.e. Calendar, location information, number of runs etc. Each scenario can have many Simulations.
/{usrnm}/prj/{prj-id}/scn/{scn-id}/sim | GET /{usrnm}/prj/{prj-id}/scn/{scn-id}/sim | index
Fetches all the Simulations inside the scenario.
Consumes: Route
Produces: JSON
{
simulations: [
{id=1, name: "Summer simulation"},
{id=2, name: "Winter simulation"}
]
}
--
/{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/{sim-id} | GET /{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/{sim-id} | show
Fetches the properties (simulation parameters) of a Simulation.
Consumes: Route
Produces: JSON
{
id=1,
name="Summer simulation",
calendar: {
dayOfMonth: ...,
dayOfWeek: ...,
month: ...,
year: ...
},
locationInfo: {
lat: ...,
lng: ...
},
numberOfRuns: {
n = 10
}
}
--
/{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/new | GET /{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/new | new
Prepares for editing a new Simulation. Can be though as of loading an empty Simulation (empty form).
Consumes: Route
Produces: JSON
--
/{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/{sim-id}/edit | GET /{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/{sim-id}/edit | edit
Fetches the properties of the Simulation for editing.
Consumes: Route
Produces: JSON
/{usrnm}/prj/{prj-id}/scn/{scn-id}/sim | POST /{usrnm}/prj/{prj-id}/scn/{scn-id}/sim | create
Creates a new _Simulation for the given Scenario, based on the properties filled up by the user when creating a new Simulation.
Consumes: Route, JSON
Produces: Create status
/{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/{sim-id} | PUT /{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/{sim-id} | update
Updates the properties of the Simulation after editing.
Consumes: Route, JSON
Produces: Update status
/{usrnm}/prj/{prj-id}/scn/{scn-id}/sim | DELETE /{usrnm}/prj/{prj-id}/scn/{scn-id}/sim/{sim-id} | delete
Deletes the existing Simulation.
Consumes: Route
Produces: Delete status
A run is created when a user decides to execute a scenario given some simulation parameters.
/{usrnm}/prj/{prj-id}/runs | GET /{usrnm}/prj/{prj-id}/runs | index
Displays a list with all the runs (queued, completed, running) under the given project.
Consumes: Route
Produces: JSON
{
runs: [
{id=1, status=completed, percentage=100},
{id=2, status=running, percentage=45},
{id=3, status=queued, percentage=0}
]
}
--
/{usrnm}/prj/{prj-id}/runs/{run-id} | GET /{usrnm}/prj/{prj-id}/runs/{run-id} | show
Displays the status and/or the results of the given run.
Consumes: Route
Produces: JSON
{
id:1,
status=completed,
percentage=100
results {
...
},
statistics {
...
},
summary {
...
}
}
/{usrnm}/prj/{prj-id}/sims | POST /{usrnm}/prj/{prj-id}/sims | create
Creates a new run by posting the entire scenario.
Consumes: Route, JSON
Produces: Create status
/{usrnm}/prj/{prj-id}/sims | DELETE /{usrnm}/prj/{prj-id}/sims/{sim-id} | delete
Deletes the run along with the results.
Consumes: Route
Produces: Delete status
/{usrnm}/prj/{prj-id}/sims/{sim-id} | PUT /{usrnm}/prj/{prj-id}/sims/{sim-id}/{pause|resume} | update status
Based on what is passed in the http request the run can be paused or resumed.
Consumes: Route
Produces: Update status
We assume for now that the libraries are read-only (R ops). There is no functionality in the protocol (yet) to make CUD operations. Also Demographics and CSNs to be added in the library.
/libs | GET /libs | index
Returns a list of libs along with their ids.
--
/libs/{lib-id} | GET /libs/{lib-id} | index
For the given {lib-id} a list of contained entities is returned along with their name, type and id. These entities are structured in a tree according to their type. For now four top level types will be available: Installation, Appliance, Activity and DemandSideManagement.
--
/libs/{lib-id}/inst | GET /libs/{lib-id}/inst | index
Returns a list of Installations available in the library.
--
/libs/{lib-id}/app | GET /libs/{lib-id}/app | index
Returns a list of Appliances available in the library.
--
/libs/{lib-id}/act | GET /libs/{lib-id}/act | index
Returns a list of Activities available in the library.
--
/libs/{lib-id}/dsm | GET /libs/{lib-id}/dsm | index
Returns a list of DemandSideManagement schemes available in the library.
--
/libs/{lib-id}/inst/{inst-id} | GET /libs/{lib-id}/inst/{inst-id} | show
Displays the properties of the Installation with that {inst-id}.
--
/libs/{lib-id}/inst/{inst-id}/app | GET /libs/{lib-id}/inst/{inst-id}/app | index
Displays the Appliances of the Installation with that {inst-id}.
--
/libs/{lib-id}/inst/{inst-id}/app/{app-id} | GET /libs/{lib-id}/inst/{inst-id}/app/{app-id} | show
Displays the properties of the {app-id} Appliance of the Installation with that {inst-id}.
--
/libs/{lib-id}/inst/{inst-id}/app/{app-id}/consmod | GET /libs/{lib-id}/inst/{inst-id}/app/{app-id}/consmod | show
Displays the ConsumptionModel of the {app-id} Appliance of the Installation with that {inst-id}.
--
/libs/{lib-id}/app/{app-id} | GET /libs/{lib-id}/app/{app-id} | show
Displays the properties of the Appliance with that {app-id}.
--
/libs/{lib-id}/app/{app-id}/consmod | GET /libs/{lib-id}/app/{app-id}/consmod | show
Displays the ConsumptionModel of the given Appliance.
Users should be able to login (MD5 hash and https as minimum security requirements) and after successfully entering their credentials, they should be redirected to /api/prj
, where a list of their projects should be displayed.
Under development.
Under development.