Project resources and representations » History » Version 7
Guanji Wang, 28/07/2017 17:16
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 | 7 | Guanji Wang | | /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.| |
17 | 6 | Guanji Wang | | /projects/{projectId}/graph/notify| PUT |Manage notifications of graph resources updates| 200| OK|Response sent to indicate that handling occured| |
18 | 7 | Guanji Wang | | /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.| |
19 | 6 | Guanji Wang | | /projects| GET |Method to the list of all projects available in Sitools.| 200 | All projects' information as JSON| | |
20 | 7 | Guanji Wang | | /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.| |
21 | 1 | Guanji Wang | |
22 | 1 | Guanji Wang | |
23 | 1 | Guanji Wang | |
24 | 1 | Guanji Wang | h3. 2. Methods: |
25 | 1 | Guanji Wang | * GET: Method to retrieve a single or all projects. |
26 | 1 | 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 | 1 | Guanji Wang | curl -u $username:$userpwd -X GET http://$localhost/sitools/projects/$project_id/graph |
36 | 1 | Guanji Wang | curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/stop |
37 | 1 | Guanji Wang | curl -u $username:$userpwd -X PUT http://$HOST_DOMAIN/sitools/projects/$project_id/start |
38 | 1 | Guanji Wang | </code></pre> |
39 | 6 | Guanji Wang | |
40 | 6 | Guanji Wang | |
41 | 6 | Guanji Wang | h3. 4. Response |
42 | 6 | Guanji Wang | |
43 | 6 | Guanji Wang | h4. Headers |
44 | 6 | Guanji Wang | |
45 | 6 | Guanji Wang | |
46 | 6 | Guanji Wang | <pre><code class="javascript"> |
47 | 6 | Guanji Wang | Content-Type: application/json; charset=UTF-8 |
48 | 6 | Guanji Wang | Date: Fri, 28 Jul 2017 13:02:25 GMT |
49 | 6 | Guanji Wang | Accept-Ranges: bytes |
50 | 6 | Guanji Wang | Server: Restlet-Framework/2.0.5 |
51 | 6 | Guanji Wang | Transfer-Encoding: chunked |
52 | 6 | Guanji Wang | </code></pre> |
53 | 6 | Guanji Wang | |
54 | 6 | Guanji Wang | |
55 | 6 | Guanji Wang | |
56 | 6 | Guanji Wang | |
57 | 6 | Guanji Wang | |
58 | 6 | Guanji Wang | h4. Body: |
59 | 6 | Guanji Wang | |
60 | 6 | Guanji Wang | <pre><code class="json"> |
61 | 6 | Guanji Wang | { |
62 | 6 | Guanji Wang | "success": true, |
63 | 6 | Guanji Wang | "message": "project.stop.success", |
64 | 6 | Guanji Wang | "project": { |
65 | 6 | Guanji Wang | "id": "a8b7d16d-838e-432c-b712-f5702c1b2a39", |
66 | 6 | Guanji Wang | "name": "Medoc-Solar-Portal", |
67 | 6 | Guanji Wang | "description": "Solar datasets", |
68 | 6 | Guanji Wang | "image": { |
69 | 6 | Guanji Wang | "type": "Image", |
70 | 6 | Guanji Wang | "url": "/sitools/upload/soho_logo.gif", |
71 | 6 | Guanji Wang | "mediaType": "Image" |
72 | 6 | Guanji Wang | }, |
73 | 6 | Guanji Wang | ... |
74 | 6 | Guanji Wang | } |
75 | 6 | Guanji Wang | </code></pre> |
76 | 6 | Guanji Wang | |
77 | 1 | Guanji Wang | |
78 | 1 | Guanji Wang | h3. 4. PUT and POST |
79 | 1 | Guanji Wang | |
80 | 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). |
81 | 1 | Guanji Wang | * PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. It is not idempotent. |
82 | 1 | Guanji Wang | * POST can't be used for modifying the status of a project in Sitools. |
83 | 1 | Guanji Wang | |
84 | 1 | Guanji Wang | |
85 | 1 | Guanji Wang | h2. Representations |
86 | 1 | Guanji Wang | |
87 | 1 | Guanji Wang | * JSON response output representation (application/json - ) |
88 | 1 | Guanji Wang | |
89 | 1 | Guanji Wang | |
90 | 1 | Guanji Wang | Example: |
91 | 1 | Guanji Wang | <pre><code class="html"> |
92 | 1 | Guanji Wang | http://idoc-medoc-test/project/solar?media=json |
93 | 1 | Guanji Wang | </code></pre> |
94 | 1 | Guanji Wang | Then all information about the project come, including all XML nodes infomation, name, description, datasets result block etc.. |