forked from cassandra-project/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Scenarios
kyrcha edited this page Jul 24, 2012
·
7 revisions
RESTful protocol for Scenarios.
The following Foreign Key apply:
scenarios.project_id : Foreign Key to Projects
GET /api/scn?prj_id={prj_id} | index
Fetches the ids and names of all the Scenarios in the project defined using the query parameter prj_id
.
Consumes: Route, Parameter
Produces: JSON
{
"success": true,
"message": "Scenarios retrieved successfully",
"size": 2,
"data": [
{
"_id": {
"$oid": "4ff5bca7e4b0082c63d08df2"
},
"name": "Scenario C",
"description": "Baseline scenario",
"project_id": "4ff5bca7e4b0082c63d08df1",
"setup": "static",
"editable": true
},
{
"_id": {
"$oid": "4ff5bca7e4b0082c63d08df3"
},
"description": "Another Baseline scenario",
"editable": true,
"setup": "dynamic",
"name": "Scenario A",
"project_id": "4ff5bca7e4b0082c63d08df1",
"sim_param": {
"name": "BBBB simulation",
"numberOfDay": 33,
"scn_id": "4ff5bca7e4b0082c63d08df3",
"cid": {
"$oid": "4ff5bca7e4b0082c63d08df5"
}
}
}
]
}
GET /api/scn/{scn_id} | show
Fetches all the the names, types and ids of the entities included in the given Scenario.
Consumes: Route
Produces: JSON
{
"success": true,
"message": "Scenarios retrieved successfully",
"size": 1,
"data": [
{
"_id": {
"$oid": "4ff5bca7e4b0082c63d08df3"
},
"description": "Another Baseline scenario",
"editable": true,
"setup": "static",
"name": "Scenario A",
"project_id": "4ff5bca7e4b0082c63d08df1",
"sim_param": {
"name": "BBBB simulation",
"numberOfDay": 33,
"scn_id": "4ff5bca7e4b0082c63d08df3",
"cid": {
"$oid": "4ff5bca7e4b0082c63d08df5"
}
}
}
]
}
PUT /api/scn/{scn-id} | update
Updates the properties of the Scenario after editing.
Consumes: Route, JSON
Produces: JSON
DELETE /api/scn/{scn-id} | delete
Deletes the Scenario with the given id.
Consumes: Route
Produces: JSON with delete status
POST /api/scn | create
Consumes: Route, JSON
If from new scenario:
{
name: "Scenario C",
description: "Baseline scenario",
project_id: "4fed8654e4b019410d75e575",
"setup": "static",
editable: true
}
TODO What happens when we copy a scenario from another scenario?
Produces: JSON
{
"success": true,
"message": "Scenario created successfully",
"objectCreated": {
"name": "Scenario C",
"description": "Baseline scenario",
"project_id": "4ff5bca7e4b0082c63d08df1",
"setup": "static",
"editable": true,
"_id": {
"$oid": "4ff5c23fe4b0082c63d08e00"
}
}
}
{
"name": "Scenario",
"type": "object",
"description": "The scenario that containes the entities and the parameters for the experiment",
"properties": {
"project_id": {
"type": "string",
"description": "The ObjectId of the Project this Scenario belongs",
"optional": false
},
"name": {
"type": "string",
"description": "Name of the Scenario",
"optional": true
},
"description": {
"type": "string",
"description": "Description of the Scenario",
"optional": true
},
"setup": {
"type": "string",
"description": "Check whether the scenario will be instantiated via a static or dynamic way",
"optional": false,
"enum": [
"static",
"dynamic"
]
},
"editable": {
"type": "boolean",
"description": "When Scenario is not editable, then its a locked Run",
"optional": true
}
},
"additionalProperties" : false
}