Projet

Général

Profil

Pelle API v10 » Historique » Version 22

Nicolas BERTRAND, 09/09/2016 17:16

1 1 Nicolas BERTRAND
h1. Pelle API v10
2 2 Nicolas BERTRAND
3 22 Nicolas BERTRAND
This document describes the REST API interface to control distribution of DCPs for "Indé-CP":http://www.indecp.org .
4 22 Nicolas BERTRAND
 
5 22 Nicolas BERTRAND
The distribution is managed via the tuco:tuco.tdcpb.org 
6 22 Nicolas BERTRAND
7 2 Nicolas BERTRAND
h2. API Base URL
8 3 Nicolas BERTRAND
9 3 Nicolas BERTRAND
10 2 Nicolas BERTRAND
<pre>
11 2 Nicolas BERTRAND
https://tuco.tdcpb.org/pelle/v1.0
12 2 Nicolas BERTRAND
</pre>
13 2 Nicolas BERTRAND
14 2 Nicolas BERTRAND
h2. Authentication
15 2 Nicolas BERTRAND
16 2 Nicolas BERTRAND
HTTP requests to the REST API are protected with HTTP Basic authentication 
17 2 Nicolas BERTRAND
18 2 Nicolas BERTRAND
Example:
19 2 Nicolas BERTRAND
<pre>
20 2 Nicolas BERTRAND
curl -u <username>:<pass> -H "Content-Type: application/json" -X GET https://tuco.tdcpb.org/pelle/v1.0/exhibitors
21 2 Nicolas BERTRAND
</pre>
22 4 Nicolas BERTRAND
23 9 Nicolas BERTRAND
h2. Exhibitors Resources
24 4 Nicolas BERTRAND
25 6 Nicolas BERTRAND
h3. Exhibitor Properties
26 8 Nicolas BERTRAND
27 8 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
28 7 Nicolas BERTRAND
| cncid | Unique exhibitor authorization ID given by CNC |
29 7 Nicolas BERTRAND
| id |  Unique ID given by tuco (internal usage) |
30 7 Nicolas BERTRAND
| name | Theater name |
31 7 Nicolas BERTRAND
| address |  Exhibitor address |
32 7 Nicolas BERTRAND
| city |  Exhibitor city |
33 7 Nicolas BERTRAND
| contact |  Person to contact |
34 1 Nicolas BERTRAND
35 7 Nicolas BERTRAND
 
36 6 Nicolas BERTRAND
37 5 Nicolas BERTRAND
38 4 Nicolas BERTRAND
h3. List all exhibitors
39 4 Nicolas BERTRAND
40 4 Nicolas BERTRAND
<pre>
41 4 Nicolas BERTRAND
GET exhibitors
42 4 Nicolas BERTRAND
</pre>
43 4 Nicolas BERTRAND
44 9 Nicolas BERTRAND
Output sample:
45 1 Nicolas BERTRAND
46 1 Nicolas BERTRAND
<pre>
47 1 Nicolas BERTRAND
{
48 5 Nicolas BERTRAND
  exhibitors:[
49 5 Nicolas BERTRAND
  {
50 1 Nicolas BERTRAND
    'cncid': '123456',
51 9 Nicolas BERTRAND
    'name': 'UN CINEMA'
52 1 Nicolas BERTRAND
    'city' : LA VILLE
53 9 Nicolas BERTRAND
  },
54 9 Nicolas BERTRAND
....
55 1 Nicolas BERTRAND
 ]
56 9 Nicolas BERTRAND
}
57 9 Nicolas BERTRAND
</pre>
58 9 Nicolas BERTRAND
59 9 Nicolas BERTRAND
h3. Retrieve a exhibitor
60 9 Nicolas BERTRAND
61 9 Nicolas BERTRAND
<pre>
62 9 Nicolas BERTRAND
GET exhibitors/<cncid>
63 9 Nicolas BERTRAND
</pre>
64 9 Nicolas BERTRAND
65 9 Nicolas BERTRAND
66 9 Nicolas BERTRAND
Output sample:
67 9 Nicolas BERTRAND
68 9 Nicolas BERTRAND
<pre>
69 9 Nicolas BERTRAND
{
70 9 Nicolas BERTRAND
  exhibitors:
71 9 Nicolas BERTRAND
  {
72 9 Nicolas BERTRAND
    'cncid': '123456',
73 9 Nicolas BERTRAND
    'name': 'UN CINEMA'
74 9 Nicolas BERTRAND
    'city' : LA VILLE
75 9 Nicolas BERTRAND
  },
76 4 Nicolas BERTRAND
}
77 4 Nicolas BERTRAND
</pre>
78 10 Nicolas BERTRAND
79 10 Nicolas BERTRAND
80 10 Nicolas BERTRAND
h3. Retrieve a exhibitor current downloads
81 10 Nicolas BERTRAND
82 10 Nicolas BERTRAND
83 10 Nicolas BERTRAND
<pre>
84 10 Nicolas BERTRAND
GET exhibitors/<cncid>/current_downloads
85 10 Nicolas BERTRAND
</pre>
86 10 Nicolas BERTRAND
87 10 Nicolas BERTRAND
88 10 Nicolas BERTRAND
Output sample:
89 10 Nicolas BERTRAND
<pre>
90 10 Nicolas BERTRAND
</pre>
91 11 Nicolas BERTRAND
92 11 Nicolas BERTRAND
93 11 Nicolas BERTRAND
94 11 Nicolas BERTRAND
h2. Distributor Resources
95 11 Nicolas BERTRAND
96 11 Nicolas BERTRAND
h3. Distributor Properties
97 11 Nicolas BERTRAND
98 11 Nicolas BERTRAND
h3. List all distributors
99 11 Nicolas BERTRAND
100 11 Nicolas BERTRAND
<pre>
101 11 Nicolas BERTRAND
GET distributors
102 11 Nicolas BERTRAND
</pre>
103 11 Nicolas BERTRAND
104 11 Nicolas BERTRAND
Output sample:
105 11 Nicolas BERTRAND
106 11 Nicolas BERTRAND
h3. Retrieve a distributor
107 11 Nicolas BERTRAND
108 11 Nicolas BERTRAND
<pre>
109 11 Nicolas BERTRAND
GET distributors/<cncid>
110 11 Nicolas BERTRAND
</pre>
111 11 Nicolas BERTRAND
112 11 Nicolas BERTRAND
113 11 Nicolas BERTRAND
Output sample:
114 12 Nicolas BERTRAND
115 12 Nicolas BERTRAND
h3. List distributor catalog
116 12 Nicolas BERTRAND
<pre>
117 12 Nicolas BERTRAND
GET distributors/<cncid>/movies
118 12 Nicolas BERTRAND
</pre>
119 12 Nicolas BERTRAND
120 12 Nicolas BERTRAND
121 12 Nicolas BERTRAND
Output sample:
122 12 Nicolas BERTRAND
123 13 Nicolas BERTRAND
124 13 Nicolas BERTRAND
h2. Distribution Resources
125 13 Nicolas BERTRAND
126 17 Nicolas BERTRAND
h3. properties
127 17 Nicolas BERTRAND
128 17 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
129 17 Nicolas BERTRAND
| autorisation_date | Date of distribution autorisation |
130 17 Nicolas BERTRAND
| dcp | DCP name on distribution | 
131 17 Nicolas BERTRAND
| dcpid | Id of DCP on distribution |
132 17 Nicolas BERTRAND
| eta | Estimated Time of Accomplishment for DCP download in theater (available when _status_ is _Distribution started_ , _N/A_ else) |
133 18 Nicolas BERTRAND
| exhibitor | Exhibitor name |
134 18 Nicolas BERTRAND
| exhibitor_cncid |  Unique exhibitor authorization ID given by CNC |
135 18 Nicolas BERTRAND
| finished_transfer_date | Finished transfer to theater date |
136 18 Nicolas BERTRAND
| proress | DCP download progress in percent (available when _status_ is _Distribution started_ , _N/A_ else) |
137 18 Nicolas BERTRAND
| started_transfer_date |DCP download start date |
138 19 Nicolas BERTRAND
| status | Distribution status (cf. next table)|
139 17 Nicolas BERTRAND
140 17 Nicolas BERTRAND
141 19 Nicolas BERTRAND
*Distribution status states:*
142 1 Nicolas BERTRAND
143 1 Nicolas BERTRAND
|_. NAME |
144 19 Nicolas BERTRAND
| 'Distribution not allowed' |
145 19 Nicolas BERTRAND
| 'Distribution allowed' |
146 19 Nicolas BERTRAND
| 'Distribution started' |
147 19 Nicolas BERTRAND
| 'Distribution finished' |
148 19 Nicolas BERTRAND
| 'Distribution error' |
149 19 Nicolas BERTRAND
 
150 19 Nicolas BERTRAND
151 17 Nicolas BERTRAND
152 17 Nicolas BERTRAND
153 14 Nicolas BERTRAND
h3. Retrieve distribution status of DCP <dcpid> to exhibitor <cncid>
154 14 Nicolas BERTRAND
155 14 Nicolas BERTRAND
<pre>
156 14 Nicolas BERTRAND
GET distributions/<cncid>/<dcpid>
157 14 Nicolas BERTRAND
</pre>
158 14 Nicolas BERTRAND
159 16 Nicolas BERTRAND
Sample output
160 16 Nicolas BERTRAND
<pre>
161 16 Nicolas BERTRAND
{
162 16 Nicolas BERTRAND
    "distributions": {
163 16 Nicolas BERTRAND
        "autorisation_date": "2016-07-04T07:25:16", 
164 16 Nicolas BERTRAND
        "dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354", 
165 16 Nicolas BERTRAND
        "dcpid": 1024, 
166 16 Nicolas BERTRAND
        "eta": "N/A", 
167 16 Nicolas BERTRAND
        "exhibitor": "UTOPIA TOURNEFEUILLE", 
168 16 Nicolas BERTRAND
        "exhibitor_cncid": 431352, 
169 16 Nicolas BERTRAND
        "finished_transfer_date": "2016-07-08T11:30:55", 
170 16 Nicolas BERTRAND
        "progress": "N/A", 
171 16 Nicolas BERTRAND
        "started_transfer_date": "2016-07-04T13:29:07", 
172 16 Nicolas BERTRAND
        "status": "Distribution finished", 
173 16 Nicolas BERTRAND
        "statusId": 0
174 16 Nicolas BERTRAND
    }
175 16 Nicolas BERTRAND
}
176 16 Nicolas BERTRAND
</pre>
177 13 Nicolas BERTRAND
178 12 Nicolas BERTRAND
h3. Distribute a DCP to a distributor
179 12 Nicolas BERTRAND
180 12 Nicolas BERTRAND
<pre>
181 15 Nicolas BERTRAND
POST distributions
182 1 Nicolas BERTRAND
</pre>
183 15 Nicolas BERTRAND
184 15 Nicolas BERTRAND
Parameters
185 15 Nicolas BERTRAND
186 15 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
187 15 Nicolas BERTRAND
| cncid | Unique exhibitor authorization ID given by CNC |
188 15 Nicolas BERTRAND
| dcpid | Id of DCP to distribute |
189 16 Nicolas BERTRAND
190 16 Nicolas BERTRAND
*Sample*
191 16 Nicolas BERTRAND
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
192 21 Nicolas BERTRAND
_Input:_
193 16 Nicolas BERTRAND
<pre>
194 16 Nicolas BERTRAND
curl -H "Content-Type: application/json" \ 
195 16 Nicolas BERTRAND
-u username:password \
196 16 Nicolas BERTRAND
-X POST\
197 16 Nicolas BERTRAND
-d '{"cncid": "431352", "dcpid": "1024" }'\
198 16 Nicolas BERTRAND
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
199 16 Nicolas BERTRAND
</pre>
200 21 Nicolas BERTRAND
_Output:_
201 20 Nicolas BERTRAND
<pre>
202 20 Nicolas BERTRAND
{
203 20 Nicolas BERTRAND
code 201 CREATED
204 20 Nicolas BERTRAND
{
205 20 Nicolas BERTRAND
    "distributions": {
206 20 Nicolas BERTRAND
        "autorisation_date": "2016-07-04T07:25:16", 
207 20 Nicolas BERTRAND
        "dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354", 
208 20 Nicolas BERTRAND
        "dcpid": 1024, 
209 20 Nicolas BERTRAND
        "eta": "N/A", 
210 20 Nicolas BERTRAND
        "exhibitor": "UTOPIA TOURNEFEUILLE", 
211 20 Nicolas BERTRAND
        "exhibitor_cncid": 431352, 
212 20 Nicolas BERTRAND
        "finished_transfer_date": "2016-07-08T11:30:55", 
213 20 Nicolas BERTRAND
        "progress": "N/A", 
214 20 Nicolas BERTRAND
        "started_transfer_date": "2016-07-04T13:29:07", 
215 20 Nicolas BERTRAND
        "status": "Distribution finished", 
216 20 Nicolas BERTRAND
    }
217 20 Nicolas BERTRAND
}
218 20 Nicolas BERTRAND
</pre>
219 20 Nicolas BERTRAND
220 20 Nicolas BERTRAND
h3. Delete a distribution instance
221 20 Nicolas BERTRAND
222 20 Nicolas BERTRAND
<pre>
223 20 Nicolas BERTRAND
DELETE distributions/<cncid>/<dcpid>
224 20 Nicolas BERTRAND
</pre>
225 20 Nicolas BERTRAND
226 20 Nicolas BERTRAND
*Sample*
227 20 Nicolas BERTRAND
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
228 20 Nicolas BERTRAND
_Input_
229 20 Nicolas BERTRAND
<pre>
230 20 Nicolas BERTRAND
curl \ 
231 20 Nicolas BERTRAND
-u username:password \
232 20 Nicolas BERTRAND
-X DELETE\
233 20 Nicolas BERTRAND
-d '{"cncid": "431352", "dcpid": "1024" }'\
234 20 Nicolas BERTRAND
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
235 20 Nicolas BERTRAND
</pre>
236 20 Nicolas BERTRAND
237 20 Nicolas BERTRAND
_Output_
238 20 Nicolas BERTRAND
<pre>
239 20 Nicolas BERTRAND
No output
240 20 Nicolas BERTRAND
code 204 NO CONTENT
241 20 Nicolas BERTRAND
</pre>