This endpoint allows working with the Buto Apikey system

*cli output in examples is piped through python -m json.tool to format it *

Collection /Apikey

Working with api keys for the Buto platform

GET /apikey/{api_key}

Get all the ACL entries for an API key and show what a key is authorised to do
Open to all users if requesting information for the same key used to authenticate the request
Also returns the associated user ID and organisation ID

  • string:api_key- The api key you are working with

item value
Access user | system
Full url https://api.buto.tv/v2/apikey/{api_key}
verb GET
params string:api_key

Example usage

    #!/bin/bash        

    system_api_key=<a system api key>
    api_key="43hZSqDk_Cbqd94cEEtmvVAXgCf3AB5T5KrwL_7tLvzBpc3BzL-a5n2"
    curl -s -X GET -u ${system_api_key}:x https://api.buto.tv/v2/apikey/${api_key}

returns


HTTP/1.1 200 OK ... Content-Type: application/json { "acl": [ "video::delete", "media::put" ], "key": "43hZSqDk_Cbqd94cEEtmvVAXgCf3AB5T5KrwL_7tLvzBpc3BzL-a5n2", "organisation_id": "xxxxx", "user_id": "xxxxx" }

GET /apikey/acl-list

Get all the ACL entries in our system
Used to work out which ACL entries you want to give to a user

item value
Access system
Full url https://api.buto.tv/v2/apikey/acl-list
verb GET

Example usage

    #!/bin/bash        

    system_api_key=<a system api key>
    curl -s -X GET -u ${system_api_key}:x https://api.buto.tv/v2/apikey/acl-list

returns


HTTP/1.1 200 OK ... Content-Type: application/json { "11": { "id": 11, "levels": [ "user", "admin" ], "resource": "video::getVideosByOrganisation" }, ... "64": { "id": 64, "levels": [ "user", "admin" ], "resource": "overlay::get" }, ... "99": { "id": 99, "levels": [ "user", "admin" ], "resource": "inPlayerAdverts::getForWholeCollection" } }

GET /apikey/user/${user_id}

Get all the Api keys for a specific user

  • string:user_id- The user_id of the person you're working with

item value
Access system
Full url https://api.buto.tv/v2/apikey/user_id/${user_id}
verb GET
params string:user_id

Example usage

    #!/bin/bash        

    system_api_key=<a system api key>
    user_id="KLWnB"

    curl -s -X GET -u ${system_api_key}:x https://api.buto.tv/v2/apikey/user_id/${user_id}

returns


HTTP/1.1 200 OK ... Content-Type: application/json { "acl": { "fu92PVg_h-bv5hF3QgBr4yW655BJ6cDn2NEduZbu3-36AARvA8U8bnx": { "application_name": "my key", "expires": "2015-12-22 18:21:00 GMT", "resources": { "media::put": { "acl_id": 90, "levels": [ "user", "admin" ] }, "video::delete": { "acl_id": 5, "levels": [ "user", "admin" ] } } }, "jbcUFq3P3bFyFJdmcELuEgf3gZ4exVN5v4ufZsLGXhsArS7xF_yYm6j": { "expires": null, "application_name": "my key two", "resources": { "media::put": { "acl_id": 90, "levels": [ "user", "admin" ] }, "video::delete": { "acl_id": 5, "levels": [ "user", "admin" ] } } }, "pds3Isd-99_y7tH7gTG7ZnFTmJNrn3BdsdS8FfqB": null }, "user_id": "KLWnB" }

GET /apikey/organisation/${organisation_id}

Get all the Api keys for a specific organisation

  • string:organisation_id- The organisation_id you're working with

item value
Access system
Full url https://api.buto.tv/v2/apikey/organisation/${organisation_id}
verb GET
params string:organisation_id

Example usage

    #!/bin/bash        

    system_api_key=<a system api key>
    organisation_id="Bbgwg"

    curl -s -X GET -u ${system_api_key}:x https://api.buto.tv/v2/apikey/organisation/${organisation_id}

returns


HTTP/1.1 200 OK ... Content-Type: application/json { "jhtpf": { "3YKSMTrSqBdQM42ylK45TCtCZNLPcY": null }, "dFt4h": { "LpyYKHnqlLGdFpT3r42JpJpvTnfdcc": null }, "cT5hd": { "RsZMx7DcZPdwsHx46cbdqXPQsGDg2p": null }, "KLWnB": { "fu92PVg_h-bv5hF3QgBr4yW655BJ6cDn2NEduZbu3-36AARvA8U8bnx": { "expires": "2015-12-22 18:21:00 GMT", "resources": { "media::put": { "acl_id": 90, "application_name": "my_key", "levels": [ "user", "admin" ] }, "video::delete": { "acl_id": 5, "application_name": "my_key", "levels": [ "user", "admin" ] } } }, "jbcUFq3P3bFyFJdmcELuEgf3gZ4exVN5v4ufZsLGXhsArS7xF_yYm6j": { "expires": null, "resources": { "media::put": { "acl_id": 90, "application_name": "my_key", "levels": [ "user", "admin" ] }, "video::delete": { "acl_id": 5, "application_name": "my_key", "levels": [ "user", "admin" ] } } }, "pds3Isd-99_y7tH7gTG7ZnFTmJNrn3BdsdS8FfqB": null }, ...

POST /apikey/{user_id}/generate

Create a new key for a specific user with the access to the specified resources.
To get a list of all valid resources use the GET /apikey/acl-list endpoint

  • user_id - string: the user_id you want to create the key for
  • application_name - string: the name of the key - usually its purpose (cannot be blank, each key must have a name)
  • resources - string: A json encoded array of all the resources this key should permit see GET /apikey/acl-list endpoint
  • expiry_date - string: YYYY-MM-DD HH:mm:ss TT an OPTIONAL expiry date, past which this key will be invalid (remember to specify timezone eg GMT, UTC)

item value
Access system
Full url https://api.buto.tv/v2/apikey/{user_id}/generate
verb POST
params string:user_id string:application_name string:resources string:expiry_date|YYYY-MM-DD HH:mm:ss|OPTIONAL

Example usage

    #!/bin/bash

    system_api_key=<a system api key>
    user_id="KLWnB"

    #urlencode the json array, otherwise curl cli freaks out 
    resources_array='["video::delete","media::put"]';
    resource_json=`node -e "console.log(encodeURIComponent(process.argv[1]))" ${resources_array}`

    #now curl the api
    curl -s -X POST -u ${system_api_key}:x \
    -d application_name="my new key" \
    -d expiry_date="2015-12-22 12:21 MDT" \
    -d resources=${resource_json} \
    https://api.buto.tv/v2/apikey/${user_id}/generate

returns


HTTP/1.1 200 OK ... Content-Type: application/json { "expires": "2015-12-22 18:21:00 GMT", "key": "43hZSqDk_Cbqd94cEEtmvVAXgCf3AB5T5KrwL_7tLvzBpc3BzL-a5n2", "application_name": "my new key", "resources": [ "video::delete", "media::put" ], "user_id": "KLWnB" }

PUT /apikey/{api_key}/regenerate

To regenerate and replace a key while still maintaining everything else about it. Usually used when you think a key may
have been compromised.

  • string:api_key- The api key you are working with

item value
Access system
Full url https://api.buto.tv/v2/apikey/{api_key}/regenerate
verb PUT
params string:api_key

Example

    #!/bin/bash

    system_api_key=<a system api key>
    api_key="43hZSqDk_Cbqd94cEEtmvVAXgCf3AB5T5KrwL_7tLvzBpc3BzL-a5n2"
    curl -s -X PUT -u ${system_api_key}:x https://api.buto.tv/v2/apikey/${api_key}/regenerate

returns


HTTP/1.1 200 OK ... Content-Type: application/json { "new_key": "jbcUFq3P3bFyFJdmcELuEgf3gZ4exVN5V4ufZsLGXhsArS7xFzyYm6j", "old_key": "43hZSqDk_Cbqd94cEEtmvVAXgCf3AB5T5KrwL_7tLvzBpc3BzL-a5n2" }