Project

General

Profile

Project resources and representations » History » Version 4

Marc Dexet, 28/07/2017 10:26

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