Added prototpye of SONATA gatekeeper API. Can already accept uploaded packages and...
[osm/vim-emu.git] / src / emuvim / api / sonata / README.md
1 # SONATA dummy gatekeeper API:
2
3 ## Upload a package (*.son) file:
4
5 To upload the file `simplest-example.son` do:
6
7 * `curl -i -X POST -F file=@simplest-example.son http://127.0.0.1:8000/api/packages/uploads`
8
9 To list all uploaded packages do:
10
11 * `curl http://127.0.0.1:8000/api/packages/uploads`
12
13 To instantiate (start) a service do:
14
15 * `curl ...`
16
17 To list all running services do:
18
19 * `curl ...`
20
21
22 ## API definition
23
24 This page describes the dummy gatekeeper API. This gatekeeper fakes the original platform gatekeeper during development SDK tools like son-push. 
25
26 It is also able to deploy our example service package (not any arbitrary service package!) in the emulator for the Y1 demo.
27
28 _Note: This API should converge to the API of the original GK as much as possible!_
29
30 ## REST API:
31 <table>
32 <tr>
33 <th>Endpoint:</th>
34 <th>Method:</th>
35 <th>Header:</th>
36 <th>Body:</th>
37 <th>Response:</th>
38 </tr>
39 <tr>
40 <td>/api/packages/uploads</td>
41 <td>POST</td>
42 <td>-</td>
43 <td>{file-content} as enctype=multipart/form-data</td>
44 <td>{"service_uuid": "c880aaab-f3b9-43ac-ac6b-3d27b46146b7", size=456, sha1=49ee6468dfa4ecbad440d669b249d523a38651be, error: null}</td>
45 </tr>
46 <tr>
47 <td>/api/packages/uploads</td>
48 <td>GET</td>
49 <td>-</td>
50 <td></td>
51 <td>{service_uuid_list: ["c880aaab-f3b9-43ac-ac6b-3d27b46146b7", "c880aaab-f3b9-43ac-ac6b-3d27b46146b8", "c880aaab-f3b9-43ac-ac6b-3d27b46146b9"]}</td>
52 </tr>
53 <tr>
54 <td>/api/instantiations</td>
55 <td>POST</td>
56 <td>-</td>
57 <td>{service_uuid: "c880aaab-f3b9-43ac-ac6b-3d27b46146b7"}</td>
58 <td>{service_instance_uuid: "de4567-f3b9-43ac-ac6b-3d27b461123"}</td>
59 </tr>
60 <tr>
61 <td>/api/instantiations</td>
62 <td>GET</td>
63 <td>-</td>
64 <td></td>
65 <td>{service_instance_uuid_list: ["de4567-f3b9-43ac-ac6b-3d27b461123", "de4567-f3b9-43ac-ac6b-3d27b461124", "de4567-f3b9-43ac-ac6b-3d27b461125"]}</td>
66 </tr>
67 </table>
68
69 ## Run REST API in standalone mode (without emulator):
70
71 * `sudo python src/emuvim/api/sonata/dummygatekeeper.py`