Projet

Général

Profil

Pelle API v10 » Historique » Version 42

Nicolas BERTRAND, 11/05/2017 11:43

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