Projet

Général

Profil

Pelle API v10 » Historique » Version 26

Nicolas BERTRAND, 12/09/2016 14:27

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