Projet

Général

Profil

Pelle API v10 » Historique » Version 34

Nicolas BERTRAND, 06/03/2017 15:58

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 24 Nicolas BERTRAND
The distribution is managed via the tuco:http://tuco.tdcpb.org
6 24 Nicolas BERTRAND
7 24 Nicolas BERTRAND
Basically this API provides services  
8 22 Nicolas BERTRAND
9 2 Nicolas BERTRAND
h2. API Base URL
10 3 Nicolas BERTRAND
11 23 Nicolas BERTRAND
All URLs in the reference documentation use the following base URL:
12 2 Nicolas BERTRAND
<pre>
13 2 Nicolas BERTRAND
https://tuco.tdcpb.org/pelle/v1.0
14 1 Nicolas BERTRAND
</pre>
15 23 Nicolas BERTRAND
16 2 Nicolas BERTRAND
17 2 Nicolas BERTRAND
h2. Authentication
18 2 Nicolas BERTRAND
19 34 Nicolas BERTRAND
HTTP requests to the REST API are protected with HTTP Basic authentication  and token.
20 1 Nicolas BERTRAND
21 34 Nicolas BERTRAND
To get the token URL is
22 34 Nicolas BERTRAND
<pre>
23 34 Nicolas BERTRAND
http://tuco.tdcpb.org/api/token
24 34 Nicolas BERTRAND
</pre>
25 34 Nicolas BERTRAND
26 1 Nicolas BERTRAND
Example:
27 1 Nicolas BERTRAND
<pre>
28 34 Nicolas BERTRAND
curl -u <username>:<pass> -H "Content-Type: application/json" -X GET http://tuco.tdcpb.org/api/token</pre>
29 34 Nicolas BERTRAND
</pre>
30 34 Nicolas BERTRAND
Response: 
31 34 Nicolas BERTRAND
<pre>
32 34 Nicolas BERTRAND
{
33 34 Nicolas BERTRAND
  "token": "eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ4ODgxMjc3NSwiaWF0IjoxNDg4ODEyMTc1fQ.eyJpZCI6MTk4fQ._EOcOx5gE311nbwPsstdEaoz1o3_KzUc9AY_yNewY6Q"
34 34 Nicolas BERTRAND
}
35 34 Nicolas BERTRAND
36 34 Nicolas BERTRAND
Use token:
37 34 Nicolas BERTRAND
<pre>
38 34 Nicolas BERTRAND
curl -u eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ4ODgxMjc3NSwiaWF0IjoxNDg4ODEyMTc1fQ.eyJpZCI6MTk4fQ._EOcOx5gE311nbwPsstdEaoz1o3_KzUc9AY_yNewY6Q:unused -H "Content-Type: application/json" -X GET https://tuco.tdcpb.org/pelle/v1.0/exhibitors
39 2 Nicolas BERTRAND
</pre>
40 4 Nicolas BERTRAND
41 9 Nicolas BERTRAND
h2. Exhibitors Resources
42 4 Nicolas BERTRAND
43 6 Nicolas BERTRAND
h3. Exhibitor Properties
44 8 Nicolas BERTRAND
45 8 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
46 7 Nicolas BERTRAND
| cncid | Unique exhibitor authorization ID given by CNC |
47 7 Nicolas BERTRAND
| id |  Unique ID given by tuco (internal usage) |
48 7 Nicolas BERTRAND
| name | Theater name |
49 7 Nicolas BERTRAND
| address |  Exhibitor address |
50 7 Nicolas BERTRAND
| city |  Exhibitor city |
51 7 Nicolas BERTRAND
| contact |  Person to contact |
52 1 Nicolas BERTRAND
53 7 Nicolas BERTRAND
 
54 6 Nicolas BERTRAND
55 5 Nicolas BERTRAND
56 4 Nicolas BERTRAND
h3. List all exhibitors
57 4 Nicolas BERTRAND
58 4 Nicolas BERTRAND
<pre>
59 4 Nicolas BERTRAND
GET exhibitors
60 4 Nicolas BERTRAND
</pre>
61 4 Nicolas BERTRAND
62 9 Nicolas BERTRAND
Output sample:
63 1 Nicolas BERTRAND
64 1 Nicolas BERTRAND
<pre>
65 1 Nicolas BERTRAND
{
66 5 Nicolas BERTRAND
  exhibitors:[
67 5 Nicolas BERTRAND
  {
68 1 Nicolas BERTRAND
    'cncid': '123456',
69 9 Nicolas BERTRAND
    'name': 'UN CINEMA'
70 1 Nicolas BERTRAND
    'city' : LA VILLE
71 9 Nicolas BERTRAND
  },
72 9 Nicolas BERTRAND
....
73 1 Nicolas BERTRAND
 ]
74 9 Nicolas BERTRAND
}
75 9 Nicolas BERTRAND
</pre>
76 9 Nicolas BERTRAND
77 9 Nicolas BERTRAND
h3. Retrieve a exhibitor
78 9 Nicolas BERTRAND
79 9 Nicolas BERTRAND
<pre>
80 9 Nicolas BERTRAND
GET exhibitors/<cncid>
81 9 Nicolas BERTRAND
</pre>
82 9 Nicolas BERTRAND
83 9 Nicolas BERTRAND
84 9 Nicolas BERTRAND
Output sample:
85 9 Nicolas BERTRAND
86 9 Nicolas BERTRAND
<pre>
87 9 Nicolas BERTRAND
{
88 9 Nicolas BERTRAND
  exhibitors:
89 9 Nicolas BERTRAND
  {
90 9 Nicolas BERTRAND
    'cncid': '123456',
91 9 Nicolas BERTRAND
    'name': 'UN CINEMA'
92 9 Nicolas BERTRAND
    'city' : LA VILLE
93 9 Nicolas BERTRAND
  },
94 4 Nicolas BERTRAND
}
95 4 Nicolas BERTRAND
</pre>
96 10 Nicolas BERTRAND
97 10 Nicolas BERTRAND
98 10 Nicolas BERTRAND
h3. Retrieve a exhibitor current downloads
99 10 Nicolas BERTRAND
100 10 Nicolas BERTRAND
101 10 Nicolas BERTRAND
<pre>
102 10 Nicolas BERTRAND
GET exhibitors/<cncid>/current_downloads
103 10 Nicolas BERTRAND
</pre>
104 10 Nicolas BERTRAND
105 10 Nicolas BERTRAND
106 10 Nicolas BERTRAND
Output sample:
107 10 Nicolas BERTRAND
<pre>
108 10 Nicolas BERTRAND
</pre>
109 11 Nicolas BERTRAND
110 11 Nicolas BERTRAND
111 11 Nicolas BERTRAND
112 11 Nicolas BERTRAND
h2. Distributor Resources
113 11 Nicolas BERTRAND
114 11 Nicolas BERTRAND
h3. Distributor Properties
115 26 Nicolas BERTRAND
116 25 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
117 25 Nicolas BERTRAND
| cncid | Unique ID given by CNC |
118 25 Nicolas BERTRAND
| id |  Unique ID given by tuco (internal usage) |
119 28 Nicolas BERTRAND
| name | Distributor name |
120 25 Nicolas BERTRAND
121 28 Nicolas BERTRAND
122 11 Nicolas BERTRAND
h3. List all distributors
123 11 Nicolas BERTRAND
124 11 Nicolas BERTRAND
<pre>
125 11 Nicolas BERTRAND
GET distributors
126 11 Nicolas BERTRAND
</pre>
127 11 Nicolas BERTRAND
128 11 Nicolas BERTRAND
Output sample:
129 25 Nicolas BERTRAND
<pre>
130 25 Nicolas BERTRAND
{
131 25 Nicolas BERTRAND
    "distributors": [
132 27 Nicolas BERTRAND
       {
133 27 Nicolas BERTRAND
            "cncid": 1261, 
134 27 Nicolas BERTRAND
            "distributorid": 47, 
135 27 Nicolas BERTRAND
            "name": "LES FILMS DU LOSANGE"
136 25 Nicolas BERTRAND
        }, 
137 25 Nicolas BERTRAND
        {
138 27 Nicolas BERTRAND
            "cncid": 3133, 
139 27 Nicolas BERTRAND
            "distributorid": 41, 
140 27 Nicolas BERTRAND
            "name": "URBAN DISTRIBUTION"
141 27 Nicolas BERTRAND
        }, 
142 27 Nicolas BERTRAND
143 27 Nicolas BERTRAND
    ...
144 27 Nicolas BERTRAND
    ]
145 1 Nicolas BERTRAND
} 
146 1 Nicolas BERTRAND
</pre>
147 1 Nicolas BERTRAND
148 1 Nicolas BERTRAND
h3. Retrieve a distributor
149 1 Nicolas BERTRAND
150 1 Nicolas BERTRAND
<pre>
151 1 Nicolas BERTRAND
GET distributors/<cncid>
152 1 Nicolas BERTRAND
</pre>
153 25 Nicolas BERTRAND
154 27 Nicolas BERTRAND
Output sample
155 28 Nicolas BERTRAND
<pre>
156 27 Nicolas BERTRAND
{
157 27 Nicolas BERTRAND
    "distributor": {
158 27 Nicolas BERTRAND
        "cncid": 1261, 
159 27 Nicolas BERTRAND
        "distributorid": 47, 
160 27 Nicolas BERTRAND
        "name": "LES FILMS DU LOSANGE"
161 27 Nicolas BERTRAND
    }
162 27 Nicolas BERTRAND
}
163 28 Nicolas BERTRAND
</pre>
164 12 Nicolas BERTRAND
165 12 Nicolas BERTRAND
h3. List distributor catalog
166 30 Nicolas BERTRAND
167 31 Nicolas BERTRAND
*movies properties* 
168 30 Nicolas BERTRAND
169 30 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
170 32 Nicolas BERTRAND
| movieid | Unique ID given to a movie in tuco  |
171 30 Nicolas BERTRAND
| original_title |  Orginal movie title name (optional) |
172 30 Nicolas BERTRAND
| releasedate | First movie release date |
173 31 Nicolas BERTRAND
| title | Movie title |
174 32 Nicolas BERTRAND
| dcps  | list of DCPs properties  (cf DCP properties table) | 
175 30 Nicolas BERTRAND
176 31 Nicolas BERTRAND
*DCP properties* 
177 30 Nicolas BERTRAND
178 30 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
179 32 Nicolas BERTRAND
| dcpid |  Unique ID given to a dcp in tuco |
180 32 Nicolas BERTRAND
| contentkind | Type of content( FTR, TLR, SHR) |
181 30 Nicolas BERTRAND
| name | DCP name |
182 33 Nicolas BERTRAND
| size | Size of DCP (in bytes) |
183 33 Nicolas BERTRAND
184 33 Nicolas BERTRAND
*command*
185 30 Nicolas BERTRAND
186 30 Nicolas BERTRAND
187 12 Nicolas BERTRAND
<pre>
188 12 Nicolas BERTRAND
GET distributors/<cncid>/movies
189 12 Nicolas BERTRAND
</pre>
190 12 Nicolas BERTRAND
191 12 Nicolas BERTRAND
192 30 Nicolas BERTRAND
193 12 Nicolas BERTRAND
Output sample:
194 30 Nicolas BERTRAND
195 30 Nicolas BERTRAND
196 29 Nicolas BERTRAND
<pre>
197 29 Nicolas BERTRAND
{
198 29 Nicolas BERTRAND
    "movies": [ 
199 29 Nicolas BERTRAND
        {
200 29 Nicolas BERTRAND
            "dcps": [
201 29 Nicolas BERTRAND
                {
202 29 Nicolas BERTRAND
                    "contentkind": "FTR", 
203 29 Nicolas BERTRAND
                    "dcpid": 512, 
204 29 Nicolas BERTRAND
                    "name": "LeFilsDeJoseph_FTR_F_FR-FR_FR_51_2K_LOS_20160219_DGM_IOP_OV", 
205 29 Nicolas BERTRAND
                    "size": "207208283635"
206 29 Nicolas BERTRAND
                }
207 29 Nicolas BERTRAND
            ], 
208 29 Nicolas BERTRAND
            "movieid": 330, 
209 29 Nicolas BERTRAND
            "original_title": "", 
210 29 Nicolas BERTRAND
            "releasedate": "2016-04-20", 
211 29 Nicolas BERTRAND
            "title": "LE FILS DE JOSEPH"
212 29 Nicolas BERTRAND
        }, 
213 29 Nicolas BERTRAND
        {
214 29 Nicolas BERTRAND
            "dcps": [
215 29 Nicolas BERTRAND
                {
216 29 Nicolas BERTRAND
                    "contentkind": "FTR", 
217 29 Nicolas BERTRAND
                    "dcpid": 541, 
218 29 Nicolas BERTRAND
                    "name": "LAvenir_FTR_F_FR-FR_FR_51_2K_FDL_20160229_ECL_IOP_OV", 
219 29 Nicolas BERTRAND
                    "size": "186571642897"
220 29 Nicolas BERTRAND
                }, 
221 29 Nicolas BERTRAND
                {
222 29 Nicolas BERTRAND
                    "contentkind": "TLR", 
223 29 Nicolas BERTRAND
                    "dcpid": 543, 
224 29 Nicolas BERTRAND
                    "name": "LAvenir_TLR-P-Date_F_FR-XX_FR_51_2K_FDL_20160308_ECL_IOP_OV", 
225 29 Nicolas BERTRAND
                    "size": "3100055161"
226 29 Nicolas BERTRAND
                }
227 29 Nicolas BERTRAND
            ], 
228 29 Nicolas BERTRAND
            "movieid": 343, 
229 29 Nicolas BERTRAND
            "original_title": "", 
230 29 Nicolas BERTRAND
            "releasedate": "2016-04-06", 
231 29 Nicolas BERTRAND
            "title": "L'AVENIR"
232 29 Nicolas BERTRAND
        }, 
233 29 Nicolas BERTRAND
        {
234 29 Nicolas BERTRAND
            "dcps": [
235 29 Nicolas BERTRAND
                {
236 29 Nicolas BERTRAND
                    "contentkind": "TLR", 
237 29 Nicolas BERTRAND
                    "dcpid": 1049, 
238 29 Nicolas BERTRAND
                    "name": "ResterVertical_TLR_F_FR-XX_FR_51_2K_LOS_20160704_TST_IOP_OV", 
239 29 Nicolas BERTRAND
                    "size": "1438180164"
240 29 Nicolas BERTRAND
                }
241 29 Nicolas BERTRAND
            ], 
242 29 Nicolas BERTRAND
            "movieid": 430, 
243 29 Nicolas BERTRAND
            "original_title": "", 
244 29 Nicolas BERTRAND
            "releasedate": "2016-08-24", 
245 29 Nicolas BERTRAND
            "title": "RESTER VERTICAL"
246 29 Nicolas BERTRAND
        }
247 29 Nicolas BERTRAND
    ]
248 29 Nicolas BERTRAND
}
249 29 Nicolas BERTRAND
</pre>
250 29 Nicolas BERTRAND
251 12 Nicolas BERTRAND
252 13 Nicolas BERTRAND
253 13 Nicolas BERTRAND
h2. Distribution Resources
254 13 Nicolas BERTRAND
255 17 Nicolas BERTRAND
h3. properties
256 17 Nicolas BERTRAND
257 17 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
258 17 Nicolas BERTRAND
| autorisation_date | Date of distribution autorisation |
259 17 Nicolas BERTRAND
| dcp | DCP name on distribution | 
260 17 Nicolas BERTRAND
| dcpid | Id of DCP on distribution |
261 17 Nicolas BERTRAND
| eta | Estimated Time of Accomplishment for DCP download in theater (available when _status_ is _Distribution started_ , _N/A_ else) |
262 18 Nicolas BERTRAND
| exhibitor | Exhibitor name |
263 18 Nicolas BERTRAND
| exhibitor_cncid |  Unique exhibitor authorization ID given by CNC |
264 18 Nicolas BERTRAND
| finished_transfer_date | Finished transfer to theater date |
265 18 Nicolas BERTRAND
| proress | DCP download progress in percent (available when _status_ is _Distribution started_ , _N/A_ else) |
266 18 Nicolas BERTRAND
| started_transfer_date |DCP download start date |
267 19 Nicolas BERTRAND
| status | Distribution status (cf. next table)|
268 17 Nicolas BERTRAND
269 17 Nicolas BERTRAND
270 19 Nicolas BERTRAND
*Distribution status states:*
271 1 Nicolas BERTRAND
272 1 Nicolas BERTRAND
|_. NAME |
273 19 Nicolas BERTRAND
| 'Distribution not allowed' |
274 19 Nicolas BERTRAND
| 'Distribution allowed' |
275 19 Nicolas BERTRAND
| 'Distribution started' |
276 19 Nicolas BERTRAND
| 'Distribution finished' |
277 19 Nicolas BERTRAND
| 'Distribution error' |
278 19 Nicolas BERTRAND
 
279 19 Nicolas BERTRAND
280 17 Nicolas BERTRAND
281 17 Nicolas BERTRAND
282 14 Nicolas BERTRAND
h3. Retrieve distribution status of DCP <dcpid> to exhibitor <cncid>
283 14 Nicolas BERTRAND
284 14 Nicolas BERTRAND
<pre>
285 14 Nicolas BERTRAND
GET distributions/<cncid>/<dcpid>
286 14 Nicolas BERTRAND
</pre>
287 14 Nicolas BERTRAND
288 16 Nicolas BERTRAND
Sample output
289 16 Nicolas BERTRAND
<pre>
290 16 Nicolas BERTRAND
{
291 16 Nicolas BERTRAND
    "distributions": {
292 16 Nicolas BERTRAND
        "autorisation_date": "2016-07-04T07:25:16", 
293 16 Nicolas BERTRAND
        "dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354", 
294 16 Nicolas BERTRAND
        "dcpid": 1024, 
295 16 Nicolas BERTRAND
        "eta": "N/A", 
296 16 Nicolas BERTRAND
        "exhibitor": "UTOPIA TOURNEFEUILLE", 
297 16 Nicolas BERTRAND
        "exhibitor_cncid": 431352, 
298 16 Nicolas BERTRAND
        "finished_transfer_date": "2016-07-08T11:30:55", 
299 16 Nicolas BERTRAND
        "progress": "N/A", 
300 16 Nicolas BERTRAND
        "started_transfer_date": "2016-07-04T13:29:07", 
301 16 Nicolas BERTRAND
        "status": "Distribution finished", 
302 16 Nicolas BERTRAND
        "statusId": 0
303 16 Nicolas BERTRAND
    }
304 16 Nicolas BERTRAND
}
305 16 Nicolas BERTRAND
</pre>
306 13 Nicolas BERTRAND
307 12 Nicolas BERTRAND
h3. Distribute a DCP to a distributor
308 12 Nicolas BERTRAND
309 12 Nicolas BERTRAND
<pre>
310 15 Nicolas BERTRAND
POST distributions
311 1 Nicolas BERTRAND
</pre>
312 15 Nicolas BERTRAND
313 15 Nicolas BERTRAND
Parameters
314 15 Nicolas BERTRAND
315 15 Nicolas BERTRAND
|_. NAME |_. DESCRIPTION |
316 15 Nicolas BERTRAND
| cncid | Unique exhibitor authorization ID given by CNC |
317 15 Nicolas BERTRAND
| dcpid | Id of DCP to distribute |
318 16 Nicolas BERTRAND
319 16 Nicolas BERTRAND
*Sample*
320 16 Nicolas BERTRAND
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
321 21 Nicolas BERTRAND
_Input:_
322 16 Nicolas BERTRAND
<pre>
323 16 Nicolas BERTRAND
curl -H "Content-Type: application/json" \ 
324 16 Nicolas BERTRAND
-u username:password \
325 16 Nicolas BERTRAND
-X POST\
326 16 Nicolas BERTRAND
-d '{"cncid": "431352", "dcpid": "1024" }'\
327 16 Nicolas BERTRAND
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
328 16 Nicolas BERTRAND
</pre>
329 21 Nicolas BERTRAND
_Output:_
330 20 Nicolas BERTRAND
<pre>
331 20 Nicolas BERTRAND
{
332 20 Nicolas BERTRAND
code 201 CREATED
333 20 Nicolas BERTRAND
{
334 20 Nicolas BERTRAND
    "distributions": {
335 20 Nicolas BERTRAND
        "autorisation_date": "2016-07-04T07:25:16", 
336 20 Nicolas BERTRAND
        "dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354", 
337 20 Nicolas BERTRAND
        "dcpid": 1024, 
338 20 Nicolas BERTRAND
        "eta": "N/A", 
339 20 Nicolas BERTRAND
        "exhibitor": "UTOPIA TOURNEFEUILLE", 
340 20 Nicolas BERTRAND
        "exhibitor_cncid": 431352, 
341 20 Nicolas BERTRAND
        "finished_transfer_date": "2016-07-08T11:30:55", 
342 20 Nicolas BERTRAND
        "progress": "N/A", 
343 20 Nicolas BERTRAND
        "started_transfer_date": "2016-07-04T13:29:07", 
344 20 Nicolas BERTRAND
        "status": "Distribution finished", 
345 20 Nicolas BERTRAND
    }
346 20 Nicolas BERTRAND
}
347 20 Nicolas BERTRAND
</pre>
348 20 Nicolas BERTRAND
349 20 Nicolas BERTRAND
h3. Delete a distribution instance
350 20 Nicolas BERTRAND
351 20 Nicolas BERTRAND
<pre>
352 20 Nicolas BERTRAND
DELETE distributions/<cncid>/<dcpid>
353 20 Nicolas BERTRAND
</pre>
354 20 Nicolas BERTRAND
355 20 Nicolas BERTRAND
*Sample*
356 20 Nicolas BERTRAND
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
357 20 Nicolas BERTRAND
_Input_
358 20 Nicolas BERTRAND
<pre>
359 20 Nicolas BERTRAND
curl \ 
360 20 Nicolas BERTRAND
-u username:password \
361 20 Nicolas BERTRAND
-X DELETE\
362 20 Nicolas BERTRAND
-d '{"cncid": "431352", "dcpid": "1024" }'\
363 20 Nicolas BERTRAND
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
364 20 Nicolas BERTRAND
</pre>
365 20 Nicolas BERTRAND
366 20 Nicolas BERTRAND
_Output_
367 20 Nicolas BERTRAND
<pre>
368 20 Nicolas BERTRAND
No output
369 20 Nicolas BERTRAND
code 204 NO CONTENT
370 20 Nicolas BERTRAND
</pre>