forked from cassandra-project/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Projects
kyrcha edited this page Jul 23, 2012
·
5 revisions
RESTful protocol for projects.
GET /api/prj | index
Fetches the projects of the authenticated user. During the first prototype authentication may not be as important.
Consumes: Route
Produces: JSON
{
"success": true,
"message": "Project(s) retrieved successfully",
"size": 2,
"data": [
{
"_id":
{
"$oid": "4ff5bca7e4b0082c63d08df0"
},
"name": "My second project",
"description": "Another project"
},
{
"_id":
{
"$oid": "4ff5bca7e4b0082c63d08df1"
},
"name": "My project",
"description": "A project"
}
]
}
GET /api/prj/{prj_id} | show
Fetch the properties of a specific project.
Consumes: Route
Produces: JSON
{
"success": true,
"message": "Project(s) retrieved successfully",
"size": 1,
"data": [
{
"_id": {
"$oid": "4ff5bca7e4b0082c63d08df1"
},
"name": "My project",
"description": "A project"
}
]
}
if not found:
{
"success": true,
"message": "Project(s) retrieved successfully (No data were found though)",
"size": 0,
"data": []
}
if wrong MongoId provided:
{
"success": false,
"exception": "invalid ObjectId [4ff5bca7e4b0082c63d08df]",
"message": "Cannot get entity for collection: projects with qKey=_id and qValue=4ff5bca7e4b0082c63d08df"
}
PUT /{usrnm}/prj/{prj_id} | update
Updates the properties of a project under the project id in the route.
Consumes: Route, JSON
{
name : "My project",
description : "A project"
}
Produces: JSON
{
"success": true,
"message": "Project updated successfully",
"size": 1,
"data": [
{
"_id": {
"$oid": "4ff5bca7e4b0082c63d08df1"
},
"name": "My project",
"description": "A project"
}
]
}
POST /api/prj | create
Creates a new project based on the properties filled up in the form and sent in JSON format
Consumes: Route, JSON
{
name : "My project",
description : "A project"
}
Produces: JSON, Create status (if failed)
{
"success": true,
"message": "Project created successfully",
"objectCreated": {
"name": "My project",
"description": "A project",
"_id": {
"$oid": "4ff5bf83e4b0082c63d08dff"
}
}
}
DELETE /api/prj/{prj_id} | delete
Deletes the specific project.
Consumes: Route
Produces: Delete status in JSON
{
"success": true,
"message": "Object Removed",
"idToRemove": "4ff5bf83e4b0082c63d08dff",
"objectRemoved": {
"_id": {
"$oid": "4ff5bf83e4b0082c63d08dff"
},
"name": "My project",
"description": "A project"
}
}
{
"name": "Project",
"type": "object",
"description": "The project of a user containing his scenarios of experiments",
"properties": {
"name": {
"type": "string",
"description": "Name of the project",
"optional": true
},
"description": {
"type": "string",
"description": "Description of the project",
"optional": true
}
},
"additionalProperties" : false
}