Connect to the Li5 API

Once you have an api key with the right permissions you are ready to connect to our API. Send your requests to li5 api base URL https://api.li5.com.

Authorization

Make an HTTP POST to /v1/authorize in order to get a valid access_token to make further requests.

Parameters:

name description value
type Authentication type api_key
api_key The api key value {YOUR_API_KEY}

Response:

{
    "refresh_token": "{refresh_token}",
    "access_token": "{access_token}",
    "expires_in": 900
}

Use your access_token in subsequent request by adding an Authorization header: “Authorization: Bearer {access_token}

Upload Content

The upload content API consists of 3 endpoints, which relates to 3 states of uploading process, start, transfer and finish. This allows you to implement a multipart upload process for large files.

Start upload

POST /v1/media

Parameters:

name description value
type The file mime type (only image/* and video/* allowed) Eg: “video/mp4” or “image/jpeg”
size The file size in bytes Eg: 10485760

Response:

{
    "data": {
        "id": "{YOUR_MEDIA_ID}",
        "type": "video",
        "status": "processing",
        "created_at": "2017-11-09T15:04:29+00:00",
        "variants": {
            "hls": null,
            "mp4": null,
            "dash": null,
            "preview": null,
            "poster": null,
            "poster_preview": null
        }
    }
}

Transfer data

POST /v1/media/{YOUR_MEDIA_ID}/actions/transfer

Parameters:

name description value
part The part number you are uploading starting from 1 Eg: 1
chunk Bytes for the part you are uploading Base 64 encoded bytes as a multipart payload for the request

Response:

{
    "success":true
}

Finish upload

POST /v1/media/{YOUR_MEDIA_ID}/actions/finish

Parameters:

None

Response:

Http status 204

Create an UMA

The assets endpoint allows you to create a Universal Media Asset in which you can attach your uploaded media and some other data:

POST /v1/assets

Parameters:

name description value
channels A list of channels on which your UMA will be published under. Required Eg: [25, 155, 547]
tags A list of labels to tag your media object. Required Eg: “[‘news’, ‘gagdets’, ‘deals’]
preview A media ID that will be attached to your asset. This represents the main media related to this object. Required Eg: 12345
asset A media ID that will be attached to your asset as an extra content. Optional Eg: 12346
label A short text that will be displayed as a title for your media. Optional Eg: “Best Seller”, “Weather”
url When watching your media a “url” will provide additional content to your users. Optional Eg: “http://www.li5.com/
attributes A list of custom key/value parameters you wish to save towards an UMA. Optional Eg: {‘productId’: 1556, ‘customKey’: ‘customValue’}

Response:

{
    "data": {
        "id": "a9b0bc50-8bc2-4aa1-a666-db31be20b0fa",
        "status": "processing",
        "label": null,
        "channels": [
            {
                "id": "6aae93a9-bdae-11e7-9b2c-06ce06799243",
                "name": "#General",
                "created_at": "2017-09-21T21:40:07+00:00",
                "updated_at": "2017-09-21T21:40:07+00:00",
                "owner": {
                    "name": "Li5 Demo",
                    "role": "Admin"
                }
            }
        ],
        "url": null,
        "tags": [
            "test",
            "api"
        ],
        "preview": {
            "id": 614,
            "type": "video",
            "status": "processing",
            "created_at": "2017-11-09T15:04:29+00:00",
            "variants": {
                "hls": null,
                "mp4": null,
                "dash": null,
                "preview": "https://li5-staging-media.s3.amazonaws.com/public/6b/89/f0/bd/2/679c492fa409ff81ca64e711/preview.webp",
                "poster": "https://li5-staging-media.s3.amazonaws.com/public/6b/89/f0/bd/2/679c492fa409ff81ca64e711/poster.jpeg",
                "poster_preview": "{{BASE64_ENCODED_PREVIEW}}"
            }
        },
        "asset": null,
        "created_at": "2017-11-09T15:04:42+00:00",
        "updated_at": "2017-11-09T15:04:42+00:00",
        "expires_at": null,
        "owner": {
            "name": "Li5 Demo",
            "role": "Admin"
        },
        "attributes": []
    }
}