Pelle API v10 » Historique » Version 43
« Précédent -
Version 43/45
(diff) -
Suivant » -
Version actuelle
Nicolas BERTRAND, 11/05/2017 11:44
Pelle API v10¶
This document describes the REST API interface to control distribution of DCPs for Indé-CP .
The distribution is managed via the tuco:http://tuco.tdcpb.org
Basically this API provides services
API Base URL¶
All URLs in the reference documentation use the following base URL:
https://tuco.tdcpb.org/pelle/v1.0
Authentication¶
HTTP requests to the REST API are protected with HTTP Basic authentication and token. The token is valid for 10 minutes.
To get the token URL is
https://tuco.tdcpb.org/api/token
Example:
curl -u <token>:unused -H "Content-Type: application/json" -X GET https://tuco.tdcpb.org/api/token
Response:
{ "token": "eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ4ODgxMjc3NSwiaWF0IjoxNDg4ODEyMTc1fQ.eyJpZCI6MTk4fQ._EOcOx5gE311nbwPsstdEaoz1o3_KzUc9AY_yNewY6Q", "expiration": "yyyy-mm-ddTHH:MM:SS" }
Use token:
curl -u eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ4ODgxMjc3NSwiaWF0IjoxNDg4ODEyMTc1fQ.eyJpZCI6MTk4fQ._EOcOx5gE311nbwPsstdEaoz1o3_KzUc9AY_yNewY6Q:unused -H "Content-Type: application/json" -X GET https://tuco.tdcpb.org/pelle/v1.0/exhibitors
Exhibitors Resources¶
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 |
List all exhibitors¶
GET exhibitors
Output sample:
{ exhibitors:[ { 'cncid': '123456', 'name': 'UN CINEMA' 'city' : LA VILLE }, .... ] }
Retrieve a exhibitor¶
GET exhibitors/<cncid>
Output sample:
{ exhibitors: { 'cncid': '123456', 'name': 'UN CINEMA' 'city' : LA VILLE }, }
Retrieve a exhibitor current downloads¶
GET exhibitors/<cncid>/current_downloads
Output sample:
Distributor Resources¶
Distributor Properties¶
NAME | DESCRIPTION |
---|---|
cncid | Unique ID given by CNC |
id | Unique ID given by tuco (internal usage) |
name | Distributor name |
List all distributors¶
GET distributors
Output sample:
{ "distributors": [ { "cncid": 1261, "distributorid": 47, "name": "LES FILMS DU LOSANGE" }, { "cncid": 3133, "distributorid": 41, "name": "URBAN DISTRIBUTION" }, ... ] }
Retrieve a distributor¶
GET distributors/<cncid>
Output sample
{ "distributor": { "cncid": 1261, "distributorid": 47, "name": "LES FILMS DU LOSANGE" } }
List distributor catalog¶
movies properties
NAME | DESCRIPTION |
---|---|
movieid | Unique ID given to a movie in tuco |
original_title | Orginal movie title name (optional) |
releasedate | First movie release date |
title | Movie title |
dcps | list of DCPs properties (cf DCP properties table) |
DCP properties
NAME | DESCRIPTION |
---|---|
dcpid | Unique ID given to a dcp in tuco |
contentkind | Type of content( FTR, TLR, SHR) |
name | DCP name |
size | Size of DCP (in bytes) |
command
GET distributors/<cncid>/movies
Output sample:
{ "movies": [ { "dcps": [ { "contentkind": "FTR", "dcpid": 512, "name": "LeFilsDeJoseph_FTR_F_FR-FR_FR_51_2K_LOS_20160219_DGM_IOP_OV", "size": "207208283635" } ], "movieid": 330, "original_title": "", "releasedate": "2016-04-20", "title": "LE FILS DE JOSEPH" }, { "dcps": [ { "contentkind": "FTR", "dcpid": 541, "name": "LAvenir_FTR_F_FR-FR_FR_51_2K_FDL_20160229_ECL_IOP_OV", "size": "186571642897" }, { "contentkind": "TLR", "dcpid": 543, "name": "LAvenir_TLR-P-Date_F_FR-XX_FR_51_2K_FDL_20160308_ECL_IOP_OV", "size": "3100055161" } ], "movieid": 343, "original_title": "", "releasedate": "2016-04-06", "title": "L'AVENIR" }, { "dcps": [ { "contentkind": "TLR", "dcpid": 1049, "name": "ResterVertical_TLR_F_FR-XX_FR_51_2K_LOS_20160704_TST_IOP_OV", "size": "1438180164" } ], "movieid": 430, "original_title": "", "releasedate": "2016-08-24", "title": "RESTER VERTICAL" } ] }
Distribution Resources¶
properties¶
NAME | DESCRIPTION |
---|---|
distributionid | unique distributionid |
autorisation_date | Date of distribution authorization |
isauthorised | is dcp authorized to download |
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 , null 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 , null else) |
started_transfer_date | DCP download start date |
status | Distribution status (cf. next table) |
statusId | Distribution status ID (cf. next table) |
Distribution status states:
status | _. statusId |
---|---|
'Distribution not allowed' | O |
'Distribution allowed' | 1 |
'Distribution started' | 2 |
'Distribution finished' | 4 |
'Distribution error' | 128 |
Retrieve distribution status of DCP <dcpid> to exhibitor <cncid>¶
GET distributions/<cncid>/<dcpid>
Sample output
{ "distributions": { "autorisation_date": "2016-07-04T07:25:16", "isauthorised": true, "distributionid": 39547, "dcp": "HAUT-ET-COURT_TONI-ERDMANN_2K-F-185_51-DE_ST-FR_DCP-24-IOP-CPT_1606TVS7354", "dcpid": 1024, "eta": null, "exhibitor": "UTOPIA TOURNEFEUILLE", "exhibitor_cncid": 431352, "finished_transfer_date": "2016-07-08T11:30:55", "progress": null, "started_transfer_date": "2016-07-04T13:29:07", "status": "Distribution finished", "statusId": 4 } }
Distribute a DCP to a distributor¶
POST distributions
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:
curl -H "Content-Type: application/json" \ -u <token>:unused \ -X POST\ -d '{"cncid": "431352", "dcpid": "1024" }'\ -i https://tuco.tdcpb.org/pelle/v1.0/distributions
Output:
{ 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", } }
Remove distribution authorisation¶
DELETE distributions/<cncid>/<dcpid>
Sample
Remove download authorisation for Toni Erdman FTR DCP (dcpid: 1024) to Utopia tournefeuille( cncid: 431352 )
Input
curl \ -u <token>:unused \ -X DELETE\ -d '{"cncid": "431352", "dcpid": "1024" }'\ -i https://tuco.tdcpb.org/pelle/v1.0/distributions
Output
No output code 204 NO CONTENT