This endpoint allows you to get and set media details. In the Buto platform the individual video publishes belong to a parent media.

Collection /media

To work with individual media items

GET /media/:id

GET details for a particular platform media

item value
Access user
Full url https://api.buto.tv/v2/media/{id}
verb GET
params string:id

Example usage


curl -u API_KEY:x --include https://api.buto.tv/v2/media/NFSdb

returns

HTTP/1.1 200 OK
...
Content-Type: application/json

{
    "media_id": "NFSdb",
    "original_filename": 'video_authentication_techniques.mov',
    "encoded_filename": ["NFSdb_1200.mp4","NFSdb_3500.wmv"],
    "token_required_platform": false
}

PUT /media/:id

Replace a video or update certain details for a particular media item

NB You cannot replace a media and update any details at the same time, you can only do one or the other. Either supply some fields or supply a uri

NB2 System key users can also edit some additional fields, see the api media controller code for more details

item value
Access system, user
Full url https://api.buto.tv/v2/media/{id}
verb PUT
params string:media_id, OPTIONAL:string:uri: the uri to a publicly available video source file, OPTIONAL:string:title: the title of the media, OPTIONAL:int:gif_status: the gif status of a media

Example 1: Replacing a media with a new one from a source


#use PHP on the CLI to url encode our incoming data data="uri=`php -r 'echo urlencode("https://dl.dropboxusercontent.com/u/22548/2015-11-16%2014.35.29.mov");'`" curl -X PUT -u ${api_key}:x --data ${data} https://api.buto.tv/v2/media/LJ35q

returns


HTTP/1.1 200 OK ... Content-Type: application/json { "media_id":"LJ35q", "status":{ "action":"replace_video", "success":"true", "uri":"https:\/\/dl.dropboxusercontent.com\/u\/22548\/2015-11-16%2014.35.29.mov" } }

Example 2: Changing some media metadata


#use PHP on the CLI to url encode our incoming data data="title=`php -r 'echo urlencode("I like potatoes chipified");'`" curl -X PUT -u ${api_key}:x --data ${data} https://api.buto.tv/v2/media/LJ35q

returns

    HTTP/1.1 200 OK
    ...
    Content-Type: application/json

    {  
       "media_id":"LJ35q",
       "status":{  
          "action":"update_data",
          "success":"true",
          "data":{
            "title": "I like potatoes chipified"
            }
          }
       }
    }

DELETE /media/:id

Delete a media item and all of its publishes.

  • media_id - string: the media_id you want to delete : REQUIRED
  • user_id - string: the user_id of the user doing the delete: REQUIRED
  • notes - string: any notes you want to add against a delete entry: OPTIONAL
item value
Access system | user
Full url https://api.buto.tv/v2/media/{media_id}/user_id/{user_id}?notes=url_encoded_notes
verb DELETE
params string:media_id, string:user_id, string:notes

Example

curl -X DELETE -u <your_api_key>:x --include https://api.buto.tv/v2/media/12345/user_id/fs33d

returns

HTTP/1.1 200 OK
...
Content-Type: application/json

{"id":"12345", "result":true, "deleted":"2015-03-04 11:26:17"}

Collection /encodingformat

To set and get encoding formats for a specific media.

Notes


  • These endpoints are protected with an API key, SYSTEM ONLY

GET /media/encodingformat/:media_id

Get a media's encoding formats

item value
Access system
Full url https://api.buto.tv/v2/media/encodingformat/{media_id}
verb GET
params string:media_id:the media id

Example usage

curl -X GET -u ${api_key}:x https://api.buto.tv/v2/media/encodingformat/NFSdb

returns

HTTP/1.1 200 OK
...
Content-Type: application/json

{
    "webm_1202": {
        "aspect_mode": "preserve", 
        "audio_bitrate": 128, 
        "audio_channels": 2, 
        "audio_codec": "vorbis", 
        "audio_sample_rate": 44100, 
        "format": "webm", 
        "keyframe_interval": 15, 
        "label": 2, 
        "size": "853x480", 
        "speed": 2, 
        "upscale": true,
        "video_bitrate": 1202, 
        "video_codec": "vp8"
    }, 
    "media_id": "NFSdb", 
    "organisation_id": "Bbgwg", 
    "title": "Hobbit Trailer 2015"
}

POST /media/encodingformat-post/:media_id

Add additional encoding formats for a media

item value
Access system
Full url https://api.buto.tv/v2/media/encodingformat-post/{media_id}
verb POST
params string:media_id: the media id , "int:encodingformat: the encoding format profile you wish to apply"
curl -X POST -u ${api_key}:x --data-binary "encodingformat=24" https://api.buto.tv/v2/media/encodingformat-post/NFSdb

returns

HTTP/1.1 200 OK
...
Content-Type: application/json

{
    "media_id": "NFSdb", 
    "organisation_id": "Bbgwg", 
    "title": "Superman Vs Thundercats",
    "1200_wmv": {
        "aspect_mode": "preserve", 
        "audio_bitrate": 128, 
        "audio_channels": 2, 
        "audio_codec": "wmv", 
        "audio_sample_rate": 44100, 
        "format": "wmv", 
        "keyframe_interval": 15, 
        "label": 2, 
        "size": "853x480", 
        "speed": 2, 
        "upscale": true,
        "video_bitrate": 1200, 
        "video_codec": "microsoft"
    }
}