Projet

Général

Profil

Pelle API v10 » Historique » Version 37

Nicolas BERTRAND, 06/03/2017 16:06

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