Project

General

Profile

Project resources and representations » History » Version 2

Guanji Wang, 27/07/2017 17:20

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 1 Guanji Wang
19 1 Guanji Wang
$HOST_DOMAIN = Starter.PUBLIC_HOST_DOMAIN
20 1 Guanji Wang
21 1 Guanji Wang
h3. 2. Methods:
22 1 Guanji Wang
* GET: Resource to modify the current status of a project.
23 1 Guanji Wang
* PUT: Resource 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 2 Guanji Wang
curl -u $username:$userpwd -X GET http://$localhost/sitools/projects/$project_id/graph
33 2 Guanji Wang
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/stop
34 2 Guanji Wang
curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/start
35 1 Guanji Wang
</code></pre>
36 1 Guanji Wang
37 1 Guanji Wang
h3. 4. PUT and POST
38 1 Guanji Wang
39 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).
40 1 Guanji Wang
* PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. It is not idempotent.
41 1 Guanji Wang
* POST can't be used for modifying the status of a project in Sitools.
42 1 Guanji Wang
 
43 1 Guanji Wang
44 1 Guanji Wang
h2. Representations
45 1 Guanji Wang
46 1 Guanji Wang
* JSON response output representation (application/json - )
47 1 Guanji Wang
48 1 Guanji Wang
49 1 Guanji Wang
Example: 
50 1 Guanji Wang
<pre><code class="html">
51 1 Guanji Wang
http://idoc-medoc-test/project/solar?media=json
52 1 Guanji Wang
</code></pre>
53 1 Guanji Wang
Then all information about the project come, including all XML nodes infomation, name, description, datasets result block etc..