Project

General

Profile

Project resources and representations » History » Version 6

Guanji Wang, 28/07/2017 16:43

1 1 Guanji Wang
h1. Project resources and representations
2 1 Guanji Wang
3 1 Guanji Wang
4 1 Guanji Wang
h2. Resources
5 1 Guanji Wang
6 1 Guanji Wang
h3. 1. Resources List:
7 1 Guanji Wang
8 6 Guanji Wang
|_. URL                           |_.Verb|_.Description                                              |_. Code|_. Response         |_. Comments                   |
9 6 Guanji Wang
| /projects/{projectId}           | GET  |  Retrieve all information of the project and its datasets | 200   | All project's nodes and dataSets as JSON|          |
10 6 Guanji Wang
| /projects/{projectId}/start     | PUT  |  Activate the project {projectId}                         | 200   | All project's node and dataSets as JSON|           |
11 6 Guanji Wang
| /projects/{projectId}/stop      | PUT  |  deactivate the project {projectId}                       | 200   | All project's node and dataSets as JSON|           |
12 6 Guanji Wang
| /projects/{projectId}/startmaintenance| PUT  |  Activate the project maintenance {projectId}       | 200   | All project's node and dataSets as JSON|           |
13 6 Guanji Wang
| /projects/{projectId}/stopmaintenance| PUT  |  deactivate the project maintenance{projectId}       | 200   | All project's node and dataSets as JSON|           |
14 6 Guanji Wang
| /projects/{projectId}/graph| GET  |  Retrieve the information of the project graph {projectId}     | 200   | The project graph ID and nodelist asJSON |        |
15 6 Guanji Wang
| /projects/{projectId}/notify| PUT  |Manage notification of project resources updating| 200   | OK|Response sent to indicate that handling occured |
16 6 Guanji Wang
| /projects/{projectId}/graph/notify| PUT  |Manage notifications of graph resources updates| 200| OK|Response sent to indicate that handling occured|
17 6 Guanji Wang
| /projects| GET |Method to the list of all projects available in Sitools.| 200   | All projects' information as JSON|           |
18 1 Guanji Wang
19 1 Guanji Wang
20 1 Guanji Wang
21 1 Guanji Wang
h3. 2. Methods:
22 1 Guanji Wang
* GET: Method to retrieve a single or all projects.
23 1 Guanji Wang
* PUT: Method to modify the current status of a project. (activate or deactivate)
24 1 Guanji Wang
* DELETE: Method to delete a single project by ID
25 1 Guanji Wang
* POST
26 1 Guanji Wang
27 1 Guanji Wang
28 1 Guanji Wang
h3. 3. Examples:
29 1 Guanji Wang
30 1 Guanji Wang
<pre><code class="python">
31 1 Guanji Wang
curl -u $username:$userpwd -X GET http://$HOST_DOMAIN/sitools/projects/$project_id
32 1 Guanji Wang
curl -u $username:$userpwd -X GET http://$localhost/sitools/projects/$project_id/graph
33 1 Guanji Wang
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/stop
34 1 Guanji Wang
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/start
35 1 Guanji Wang
</code></pre>
36 6 Guanji Wang
37 6 Guanji Wang
38 6 Guanji Wang
h3. 4. Response 
39 6 Guanji Wang
40 6 Guanji Wang
h4. Headers
41 6 Guanji Wang
42 6 Guanji Wang
43 6 Guanji Wang
<pre><code class="javascript">
44 6 Guanji Wang
Content-Type: application/json; charset=UTF-8
45 6 Guanji Wang
Date: Fri, 28 Jul 2017 13:02:25 GMT
46 6 Guanji Wang
Accept-Ranges: bytes
47 6 Guanji Wang
Server: Restlet-Framework/2.0.5
48 6 Guanji Wang
Transfer-Encoding: chunked
49 6 Guanji Wang
</code></pre>
50 6 Guanji Wang
51 6 Guanji Wang
52 6 Guanji Wang
53 6 Guanji Wang
54 6 Guanji Wang
55 6 Guanji Wang
h4. Body:
56 6 Guanji Wang
57 6 Guanji Wang
<pre><code class="json">
58 6 Guanji Wang
{
59 6 Guanji Wang
  "success": true,
60 6 Guanji Wang
  "message": "project.stop.success",
61 6 Guanji Wang
  "project": {
62 6 Guanji Wang
    "id": "a8b7d16d-838e-432c-b712-f5702c1b2a39",
63 6 Guanji Wang
    "name": "Medoc-Solar-Portal",
64 6 Guanji Wang
    "description": "Solar datasets",
65 6 Guanji Wang
    "image": {
66 6 Guanji Wang
      "type": "Image",
67 6 Guanji Wang
      "url": "/sitools/upload/soho_logo.gif",
68 6 Guanji Wang
      "mediaType": "Image"
69 6 Guanji Wang
    },
70 6 Guanji Wang
...
71 6 Guanji Wang
}
72 6 Guanji Wang
</code></pre>
73 6 Guanji Wang
74 1 Guanji Wang
75 1 Guanji Wang
h3. 4. PUT and POST
76 1 Guanji Wang
77 1 Guanji Wang
* POST: Used to modify and update a resource. It is idempotent(Do it as many times I want with the same result at last).
78 1 Guanji Wang
* PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. It is not idempotent.
79 1 Guanji Wang
* POST can't be used for modifying the status of a project in Sitools.
80 1 Guanji Wang
 
81 1 Guanji Wang
82 1 Guanji Wang
h2. Representations
83 1 Guanji Wang
84 1 Guanji Wang
* JSON response output representation (application/json - )
85 1 Guanji Wang
86 1 Guanji Wang
87 1 Guanji Wang
Example: 
88 1 Guanji Wang
<pre><code class="html">
89 1 Guanji Wang
http://idoc-medoc-test/project/solar?media=json
90 1 Guanji Wang
</code></pre>
91 1 Guanji Wang
Then all information about the project come, including all XML nodes infomation, name, description, datasets result block etc..