Pelle API v10 » Historique » Version 28
Version 27 (Nicolas BERTRAND, 12/09/2016 14:34) → Version 28/45 (Nicolas BERTRAND, 12/09/2016 14:35)
h1. Pelle API v10
This document describes the REST API interface to control distribution of DCPs for "Indé-CP":http://www.indecp.org .
The distribution is managed via the tuco:http://tuco.tdcpb.org
Basically this API provides services
h2. API Base URL
All URLs in the reference documentation use the following base URL:
<pre>
https://tuco.tdcpb.org/pelle/v1.0
</pre>
h2. Authentication
HTTP requests to the REST API are protected with HTTP Basic authentication
Example:
<pre>
curl -u <username>:<pass> -H "Content-Type: application/json" -X GET https://tuco.tdcpb.org/pelle/v1.0/exhibitors
</pre>
h2. Exhibitors Resources
h3. Exhibitor Properties
|_. NAME |_. DESCRIPTION |
| cncid | Unique exhibitor authorization ID given by CNC |
| id | Unique ID given by tuco (internal usage) |
| name | Theater name |
| address | Exhibitor address |
| city | Exhibitor city |
| contact | Person to contact |
h3. List all exhibitors
<pre>
GET exhibitors
</pre>
Output sample:
<pre>
{
exhibitors:[
{
'cncid': '123456',
'name': 'UN CINEMA'
'city' : LA VILLE
},
....
]
}
</pre>
h3. Retrieve a exhibitor
<pre>
GET exhibitors/<cncid>
</pre>
Output sample:
<pre>
{
exhibitors:
{
'cncid': '123456',
'name': 'UN CINEMA'
'city' : LA VILLE
},
}
</pre>
h3. Retrieve a exhibitor current downloads
<pre>
GET exhibitors/<cncid>/current_downloads
</pre>
Output sample:
<pre>
</pre>
h2. Distributor Resources
h3. Distributor Properties
|_. NAME |_. DESCRIPTION |
| cncid | Unique ID given by CNC |
| id | Unique ID given by tuco (internal usage) |
| name | Distributor Theater name |
| address | Exhibitor address |
h3. List all distributors
<pre>
GET distributors
</pre>
Output sample:
<pre>
{
"distributors": [
{
"cncid": 1261,
"distributorid": 47,
"name": "LES FILMS DU LOSANGE"
},
{
"cncid": 3133,
"distributorid": 41,
"name": "URBAN DISTRIBUTION"
},
...
]
}
</pre>
h3. Retrieve a distributor
<pre>
GET distributors/<cncid>
</pre>
Output sample
<pre> </pre>
{
"distributor": {
"cncid": 1261,
"distributorid": 47,
"name": "LES FILMS DU LOSANGE"
}
}
</pre> <pre>
Output sample:
h3. List distributor catalog
<pre>
GET distributors/<cncid>/movies
</pre>
Output sample:
h2. Distribution Resources
h3. properties
|_. NAME |_. DESCRIPTION |
| autorisation_date | Date of distribution autorisation |
| dcp | DCP name on distribution |
| dcpid | Id of DCP on distribution |
| eta | Estimated Time of Accomplishment for DCP download in theater (available when _status_ is _Distribution started_ , _N/A_ else) |
| exhibitor | Exhibitor name |
| exhibitor_cncid | Unique exhibitor authorization ID given by CNC |
| finished_transfer_date | Finished transfer to theater date |
| proress | DCP download progress in percent (available when _status_ is _Distribution started_ , _N/A_ else) |
| started_transfer_date |DCP download start date |
| status | Distribution status (cf. next table)|
*Distribution status states:*
|_. NAME |
| 'Distribution not allowed' |
| 'Distribution allowed' |
| 'Distribution started' |
| 'Distribution finished' |
| 'Distribution error' |
h3. Retrieve distribution status of DCP <dcpid> to exhibitor <cncid>
<pre>
GET distributions/<cncid>/<dcpid>
</pre>
Sample output
<pre>
{
"distributions": {
"autorisation_date": "2016-07-04T07:25:16",
"dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354",
"dcpid": 1024,
"eta": "N/A",
"exhibitor": "UTOPIA TOURNEFEUILLE",
"exhibitor_cncid": 431352,
"finished_transfer_date": "2016-07-08T11:30:55",
"progress": "N/A",
"started_transfer_date": "2016-07-04T13:29:07",
"status": "Distribution finished",
"statusId": 0
}
}
</pre>
h3. Distribute a DCP to a distributor
<pre>
POST distributions
</pre>
Parameters
|_. NAME |_. DESCRIPTION |
| cncid | Unique exhibitor authorization ID given by CNC |
| dcpid | Id of DCP to distribute |
*Sample*
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
_Input:_
<pre>
curl -H "Content-Type: application/json" \
-u username:password \
-X POST\
-d '{"cncid": "431352", "dcpid": "1024" }'\
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
</pre>
_Output:_
<pre>
{
code 201 CREATED
{
"distributions": {
"autorisation_date": "2016-07-04T07:25:16",
"dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354",
"dcpid": 1024,
"eta": "N/A",
"exhibitor": "UTOPIA TOURNEFEUILLE",
"exhibitor_cncid": 431352,
"finished_transfer_date": "2016-07-08T11:30:55",
"progress": "N/A",
"started_transfer_date": "2016-07-04T13:29:07",
"status": "Distribution finished",
}
}
</pre>
h3. Delete a distribution instance
<pre>
DELETE distributions/<cncid>/<dcpid>
</pre>
*Sample*
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
_Input_
<pre>
curl \
-u username:password \
-X DELETE\
-d '{"cncid": "431352", "dcpid": "1024" }'\
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
</pre>
_Output_
<pre>
No output
code 204 NO CONTENT
</pre>
This document describes the REST API interface to control distribution of DCPs for "Indé-CP":http://www.indecp.org .
The distribution is managed via the tuco:http://tuco.tdcpb.org
Basically this API provides services
h2. API Base URL
All URLs in the reference documentation use the following base URL:
<pre>
https://tuco.tdcpb.org/pelle/v1.0
</pre>
h2. Authentication
HTTP requests to the REST API are protected with HTTP Basic authentication
Example:
<pre>
curl -u <username>:<pass> -H "Content-Type: application/json" -X GET https://tuco.tdcpb.org/pelle/v1.0/exhibitors
</pre>
h2. Exhibitors Resources
h3. Exhibitor Properties
|_. NAME |_. DESCRIPTION |
| cncid | Unique exhibitor authorization ID given by CNC |
| id | Unique ID given by tuco (internal usage) |
| name | Theater name |
| address | Exhibitor address |
| city | Exhibitor city |
| contact | Person to contact |
h3. List all exhibitors
<pre>
GET exhibitors
</pre>
Output sample:
<pre>
{
exhibitors:[
{
'cncid': '123456',
'name': 'UN CINEMA'
'city' : LA VILLE
},
....
]
}
</pre>
h3. Retrieve a exhibitor
<pre>
GET exhibitors/<cncid>
</pre>
Output sample:
<pre>
{
exhibitors:
{
'cncid': '123456',
'name': 'UN CINEMA'
'city' : LA VILLE
},
}
</pre>
h3. Retrieve a exhibitor current downloads
<pre>
GET exhibitors/<cncid>/current_downloads
</pre>
Output sample:
<pre>
</pre>
h2. Distributor Resources
h3. Distributor Properties
|_. NAME |_. DESCRIPTION |
| cncid | Unique ID given by CNC |
| id | Unique ID given by tuco (internal usage) |
| name | Distributor Theater name |
| address | Exhibitor address |
h3. List all distributors
<pre>
GET distributors
</pre>
Output sample:
<pre>
{
"distributors": [
{
"cncid": 1261,
"distributorid": 47,
"name": "LES FILMS DU LOSANGE"
},
{
"cncid": 3133,
"distributorid": 41,
"name": "URBAN DISTRIBUTION"
},
...
]
}
</pre>
h3. Retrieve a distributor
<pre>
GET distributors/<cncid>
</pre>
Output sample
<pre> </pre>
{
"distributor": {
"cncid": 1261,
"distributorid": 47,
"name": "LES FILMS DU LOSANGE"
}
}
</pre> <pre>
Output sample:
h3. List distributor catalog
<pre>
GET distributors/<cncid>/movies
</pre>
Output sample:
h2. Distribution Resources
h3. properties
|_. NAME |_. DESCRIPTION |
| autorisation_date | Date of distribution autorisation |
| dcp | DCP name on distribution |
| dcpid | Id of DCP on distribution |
| eta | Estimated Time of Accomplishment for DCP download in theater (available when _status_ is _Distribution started_ , _N/A_ else) |
| exhibitor | Exhibitor name |
| exhibitor_cncid | Unique exhibitor authorization ID given by CNC |
| finished_transfer_date | Finished transfer to theater date |
| proress | DCP download progress in percent (available when _status_ is _Distribution started_ , _N/A_ else) |
| started_transfer_date |DCP download start date |
| status | Distribution status (cf. next table)|
*Distribution status states:*
|_. NAME |
| 'Distribution not allowed' |
| 'Distribution allowed' |
| 'Distribution started' |
| 'Distribution finished' |
| 'Distribution error' |
h3. Retrieve distribution status of DCP <dcpid> to exhibitor <cncid>
<pre>
GET distributions/<cncid>/<dcpid>
</pre>
Sample output
<pre>
{
"distributions": {
"autorisation_date": "2016-07-04T07:25:16",
"dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354",
"dcpid": 1024,
"eta": "N/A",
"exhibitor": "UTOPIA TOURNEFEUILLE",
"exhibitor_cncid": 431352,
"finished_transfer_date": "2016-07-08T11:30:55",
"progress": "N/A",
"started_transfer_date": "2016-07-04T13:29:07",
"status": "Distribution finished",
"statusId": 0
}
}
</pre>
h3. Distribute a DCP to a distributor
<pre>
POST distributions
</pre>
Parameters
|_. NAME |_. DESCRIPTION |
| cncid | Unique exhibitor authorization ID given by CNC |
| dcpid | Id of DCP to distribute |
*Sample*
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
_Input:_
<pre>
curl -H "Content-Type: application/json" \
-u username:password \
-X POST\
-d '{"cncid": "431352", "dcpid": "1024" }'\
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
</pre>
_Output:_
<pre>
{
code 201 CREATED
{
"distributions": {
"autorisation_date": "2016-07-04T07:25:16",
"dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354",
"dcpid": 1024,
"eta": "N/A",
"exhibitor": "UTOPIA TOURNEFEUILLE",
"exhibitor_cncid": 431352,
"finished_transfer_date": "2016-07-08T11:30:55",
"progress": "N/A",
"started_transfer_date": "2016-07-04T13:29:07",
"status": "Distribution finished",
}
}
</pre>
h3. Delete a distribution instance
<pre>
DELETE distributions/<cncid>/<dcpid>
</pre>
*Sample*
Distribute Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
_Input_
<pre>
curl \
-u username:password \
-X DELETE\
-d '{"cncid": "431352", "dcpid": "1024" }'\
-i https://tuco.tdcpb.org/pelle/v1.0/distributions
</pre>
_Output_
<pre>
No output
code 204 NO CONTENT
</pre>