Projet

Général

Profil

Pelle API v10 » Historique » Version 23

Nicolas BERTRAND, 09/09/2016 17:17

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