Project resources and representations¶
Resources¶
1. Resources List:¶
URL | Verb | Description | Code | Response | Comments |
---|---|---|---|---|---|
/projects/{projectId} | GET | Retrieve all information of the project and its datasets | 200 | All project's nodes and dataSets as JSON | |
/projects/{projectId}/start | PUT | Activate the project {projectId} | 200 | All project's node and dataSets as JSON | |
/projects/{projectId}/stop | PUT | deactivate the project {projectId} | 200 | All project's node and dataSets as JSON | |
/projects/{projectId}/startmaintenance | PUT | Activate the project maintenance {projectId} | 200 | All project's node and dataSets as JSON | |
/projects/{projectId}/stopmaintenance | PUT | deactivate the project maintenance{projectId} | 200 | All project's node and dataSets as JSON | |
/projects/{projectId}/graph | GET | Retrieve the information of the project graph {projectId} | 200 | The project graph ID and nodelist asJSON | |
/projects/{projectId}/notify | PUT | Manage notification of project resources updating | 200 | OK | Response sent to indicate that handling occured |
/projects/{projectId}/notify | PUT | Manage notification of project resources updating | 403 | Sitools2 error page - The server understood the request, but is refusing to fulfill it | Request not authorized due to roles and methods access security configuration for this user. |
/projects/{projectId}/graph/notify | PUT | Manage notifications of graph resources updates | 200 | OK | Response sent to indicate that handling occured |
/projects/{projectId}/graph/notify | PUT | Manage notifications of graph resources updates | 403 | Sitools2 error page - The server understood the request, but is refusing to fulfill it | Request not authorized due to roles and methods access security configuration for this user. |
/projects | GET | Method to the list of all projects available in Sitools. | 200 | All projects' information as JSON | |
/projects | GET | Method to the list of all projects available in Sitools. | 403 | Sitools2 error page - The server understood the request, but is refusing to fulfill it | Request not authorized due to roles and methods access security configuration for this user. |
2. Methods:
- GET: Method to retrieve a single or all projects.
- PUT: Method to modify the current status of a project. (activate or deactivate)
- DELETE: Method to delete a single project by ID
- POST
3. Examples:¶
curl -u $username:$userpwd -X GET http://$HOST_DOMAIN/sitools/projects/$project_id
curl -u $username:$userpwd -X GET http://$localhost/sitools/projects/$project_id/graph
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/stop
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/start
4. Response¶
Headers¶
Content-Type: application/json; charset=UTF-8
Date: Fri, 28 Jul 2017 13:02:25 GMT
Accept-Ranges: bytes
Server: Restlet-Framework/2.0.5
Transfer-Encoding: chunked
Body:¶
{
"success": true,
"message": "project.stop.success",
"project": {
"id": "a8b7d16d-838e-432c-b712-f5702c1b2a39",
"name": "Medoc-Solar-Portal",
"description": "Solar datasets",
"image": {
"type": "Image",
"url": "/sitools/upload/soho_logo.gif",
"mediaType": "Image"
},
...
}
4. PUT and POST¶
- POST: Used to modify and update a resource. It is idempotent(Do it as many times I want with the same result at last).
- PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. It is not idempotent.
- POST can't be used for modifying the status of a project in Sitools.
Representations¶
- JSON response output representation (application/json - )
Example:
http://idoc-medoc-test/project/solar?media=json
Then all information about the project come, including all XML nodes infomation, name, description, datasets result block etc..