Project

General

Profile

DataSet resources and representations » History » Version 1

Guanji Wang, 27/07/2017 17:39

1 1 Guanji Wang
h1. DataSet resources and representations
2 1 Guanji Wang
3 1 Guanji Wang
h2. Resources
4 1 Guanji Wang
5 1 Guanji Wang
h3. 1. Resources List:
6 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}
7 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}/start
8 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}/getSqlString
9 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}/stop
10 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}/refresh
11 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}/notify
12 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}/mappings
13 1 Guanji Wang
* http://localhost:8184/sitools/datasets/{datasetId}/mappings/{dictionaryId}
14 1 Guanji Wang
* http://localhost:8184/sitools/datasets/
15 1 Guanji Wang
16 1 Guanji Wang
17 1 Guanji Wang
$HOST_DOMAIN = Starter.PUBLIC_HOST_DOMAIN
18 1 Guanji Wang
19 1 Guanji Wang
h3. 2. Methods:
20 1 Guanji Wang
* GET: Method to retrieve a single or all datasets
21 1 Guanji Wang
* PUT:
22 1 Guanji Wang
 1. PUT /{datasetId}/start:  Performs a start action on the dataset making the related DatasetApplication ACTIVE.
23 1 Guanji Wang
 2. PUT /{datasetId}/getSqlString: Builds and returns the underlying data source SQL request string for the dataset.
24 1 Guanji Wang
 3. PUT /{datasetId}/stop: Performs a stop action on the dataset making the related DatasetApplication INACTIVE.
25 1 Guanji Wang
26 1 Guanji Wang
27 1 Guanji Wang
h3. 3. Examples:
28 1 Guanji Wang
29 1 Guanji Wang
<pre><code class="python">
30 1 Guanji Wang
curl -u $username:$userpwd -X PUT http://$localhost/sitools/datasets/$dataset_id/start
31 1 Guanji Wang
32 1 Guanji Wang
curl -u $username:$userpwd -X PUT http://$localhost/sitools/datasets/$dataset_id/start
33 1 Guanji Wang
34 1 Guanji Wang
curl -u $username:$userpwd -X PUT http://$localhost/sitools/datasets/$dataset_id/getSqlString
35 1 Guanji Wang
36 1 Guanji Wang
</code></pre>
37 1 Guanji Wang
38 1 Guanji Wang
h3. 4. Results of the above examples: 
39 1 Guanji Wang
40 1 Guanji Wang
1.  Performs a stop action on the dataset 
41 1 Guanji Wang
!Selection_357.jpg!
42 1 Guanji Wang
2.  Performs a start action on the dataset
43 1 Guanji Wang
!Selection_359.jpg!
44 1 Guanji Wang
3.  Builds and returns the underlying data source SQL request string for the dataset.
45 1 Guanji Wang
!Selection_358.jpg!
46 1 Guanji Wang
47 1 Guanji Wang
48 1 Guanji Wang
h3. 5. PUT and POST
49 1 Guanji Wang
50 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).
51 1 Guanji Wang
* PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. It is not idempotent.
52 1 Guanji Wang
* POST can't be used for modifying the status of a dataset in Sitools.
53 1 Guanji Wang
 
54 1 Guanji Wang
55 1 Guanji Wang
h2. Representations
56 1 Guanji Wang
57 1 Guanji Wang
* JSON response output representation (application/json - )
58 1 Guanji Wang
59 1 Guanji Wang
60 1 Guanji Wang
Example: 
61 1 Guanji Wang
<pre><code class="html">
62 1 Guanji Wang
http://idoc-medoc-test/webs_PICARD_dataset?media=json
63 1 Guanji Wang
</code></pre>
64 1 Guanji Wang
Then all information about the dataset come, including all XML nodes infomation, id, name, status, description, columnModel result block etc..