Project

General

Profile

Project resources and representations » History » Version 5

Marc Dexet, 28/07/2017 11:02

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
* http://$HOST_DOMAIN/sitools/projects/{projectId}
8 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/start
9 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/stop
10 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/startmaintenance
11 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/stopmaintenance
12 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/graph
13 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/datasets
14 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/notify
15 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/{projectId}/graph/notify
16 1 Guanji Wang
* http://$HOST_DOMAIN/sitools/projects/
17 1 Guanji Wang
18 5 Marc Dexet
|_. URL   |_.Verb    |_.Description   |_. Code |_. Response |_. Comments |
19 5 Marc Dexet
| /projects/{projectId} |       GET |  Retrieve all project's dataset | 200 | All project's dataSet as JSON|            |
20 5 Marc Dexet
| /projects/{projectId}/start |  PUT |  Activate the project {projectId} | 200 | All project's dataSet as JSON|            |
21 4 Marc Dexet
22 1 Guanji Wang
23 1 Guanji Wang
$HOST_DOMAIN = Starter.PUBLIC_HOST_DOMAIN
24 1 Guanji Wang
25 1 Guanji Wang
h3. 2. Methods:
26 3 Guanji Wang
* GET: Method to retrieve a single or all projects.
27 3 Guanji Wang
* PUT: Method to modify the current status of a project. (activate or deactivate)
28 1 Guanji Wang
* DELETE: Method to delete a single project by ID
29 1 Guanji Wang
* POST
30 1 Guanji Wang
31 1 Guanji Wang
32 1 Guanji Wang
h3. 3. Examples:
33 1 Guanji Wang
34 1 Guanji Wang
<pre><code class="python">
35 1 Guanji Wang
curl -u $username:$userpwd -X GET http://$HOST_DOMAIN/sitools/projects/$project_id
36 2 Guanji Wang
curl -u $username:$userpwd -X GET http://$localhost/sitools/projects/$project_id/graph
37 2 Guanji Wang
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/stop
38 2 Guanji Wang
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/start
39 1 Guanji Wang
</code></pre>
40 1 Guanji Wang
41 1 Guanji Wang
h3. 4. PUT and POST
42 1 Guanji Wang
43 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).
44 1 Guanji Wang
* PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. It is not idempotent.
45 1 Guanji Wang
* POST can't be used for modifying the status of a project in Sitools.
46 1 Guanji Wang
 
47 1 Guanji Wang
48 1 Guanji Wang
h2. Representations
49 1 Guanji Wang
50 1 Guanji Wang
* JSON response output representation (application/json - )
51 1 Guanji Wang
52 1 Guanji Wang
53 1 Guanji Wang
Example: 
54 1 Guanji Wang
<pre><code class="html">
55 1 Guanji Wang
http://idoc-medoc-test/project/solar?media=json
56 1 Guanji Wang
</code></pre>
57 1 Guanji Wang
Then all information about the project come, including all XML nodes infomation, name, description, datasets result block etc..