NAV
cURL php JS

Introduction

Publitio offers advanced APIs for Video & Image management in the cloud.

You can use our API to access Publitio API endpoints, which can get information on various files, versions, players, adtags, and watermarks created and/or stored with us.

Here you will find documentation and reference to our REST & URL Based APIs.

We have language bindings in Shell and Php for a start (more languages coming soon)! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Getting started

  1. Create account at Publitio website
  2. Get API & Secret Keys at Dashboard
  3. Choose SDK or Framework for integration
  4. Start testing

Authentication

The Publitio API uses signature-based authentication to verify the identity of an API user. In order to make API calls, you will need API Key and API Secret, which can both be found in the Dashboard. You can also generate full API Signature at the Dashboard for the testing purposes.

Authentication parameters

In order to authenticate an API call the following parameters are required:

Parameter Description
api_key API key identifies the user to the API. It can be found in the Publitio Dashboard.
api_timestamp API timestamp is the current UNIX timestamp (32 bits signed integer). It is used to protect against replay-attacks.
api_nonce API nonce is an 8 digits random number. It is used to make sure that API signature is always unique, even if the same call has been made twice within one second.
api_signature SHA-1 digest of the api_key, api_timestamp and api_nonce.

API signature generation

The API signature is a SHA-1 digest and it is generated similar to how it is specified in OAuth Core 1.0 protocol.

  1. Parameters (api_timestamp, api_nonce and api_secret) are concatenated together into a single string:

<api_timestamp><api_nonce><api_secret>

  1. SHA-1 digest is calculated. The calculated SHA-1 HEX digest for the above string will be:

4591350417a53c4656572ab14bd4f1759a48019b

An authenticated API call will look like this:

https://api.publit.io/v1/files/list?api_key=a73eda4c9cd05a757e05ac1557f62be7&api_nonce=35367098&api_signature=4591350417a53c4656572ab14bd4f1759a48019b&api_timestamp=1515580186

Protection against replay-attacks

When signature based method is used it is possible that the call can be captured by a malicious party and “replayed” later. To protect against this type of attacks, the Publitio API implemented the following measures:

Testing API

For convinience of testing the Publitio API, you can generate full Api Signature at the Dashboard and use it via browser, Postman or curl for testing. Each API signature is valid for 1h and 1 API call. For multiple API calls and 24h TTL please append &api_test=true to the end of the API Signature.

An authenticated API call for testing will look like this:

https://api.publit.io/v1/files/list?api_key=a73eda4c9cd05a757e05ac1557f62be7&api_nonce=35367098&api_signature=4591350417a53c4656572ab14bd4f1759a48019b&api_timestamp=1515580186&api_test=true

Files

Files Class allows easy creation (uploading) and management of your images & videos. With it you can use Publitio API to upload, host, download and to deliver your files. Publitio API goes few steps further and allows you transformations & transcoding of your Files via Versions Class, publishing via HTML5 Media Player through Players Class, monetization with ads thanks to Adtags Class, even copyright protection via Watermarks Class.

Create File


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// create (upload) local file, simple
$response = $publitio_api->upload_file("samples/monkey.jpg", "file", 
    array('name' => 'mytestwm', 
          'position' => 'top-right', 
          'padding' => '20')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X POST "https://api.publit.io/v1/files/create?{{api_signature}}" \
-H "Accept: application/json" \
--form name=mytestfile \
--form file=@/localpathtoimage/file.png

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// create (upload) local file, simple
publitio.uploadFile(file, 'file')
    .then((data) => { console.log(data) })
    .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 201,
    "message": "File uploaded",
    "id": "qAfRRgxx",
    "public_id": null,
    "title": "sample file",
    "description": "",
    "tags": "",
    "type": "image",
    "extension": "jpg",
    "size": 26846,
    "width": 373,
    "height": 373,
    "privacy": "public",
    "option_download": "enabled",
    "option_ad": "enabled",
    "option_transform": "enabled",
    "wm_id": null,
    "url_preview": "https://media.publit.io/file/qAfRRgxx.jpg",
    "url_download": "https://media.publit.io/download/qAfRRgxx.jpg?at=eyJpdiI6Inc5NGg2TG1IZDB4bDJTUXpaUmRUd1E9PSIsInZhbHVlIjoiaVlIRmd3SFo5YTdOR1hMdENLZmErdGEyR3pWbk1IYmtoTHdwT0VsU25BWT0iLCJtYWMiOiI0MzlmMmYwM2IxY2YxNDE1ZmZmNjgxMGI1M2JmMjQ5NTgyZDk3N2JkN2M4ZDA1NzZhMzU1MjRiMGE2NDkwN2YyIn0=",
    "versions": 0,
    "hits": 0,
    "created_at": "2018-01-15 08:37:15",
    "updated_at": "2018-01-15 08:37:15"
}
]

This endpoint creates (uploads) new file. Right now you can upload following file types:

HTTP Request

POST https://api.publit.io/v1/files/create

Query Parameters

Parameter Required Type Description
file yes file Image or Video to upload as file.
file_url no url Remote url to image or video if no file is present.
public_id no string Unique alphanumeric public id of file. Default null
title no string Title of uploaded file. Default taken from file name.
description no string Optional description of file.
tags no string Optional tags for file. Used for search.
privacy no bool Privacy for file. Supported values are 0 (private) and 1 (public). Default 0 (private).
option_download no bool Download option for a file. Supported values are 0 (disabled) and 1 (enabled). Default 1 (enabled).
option_transform no bool Url-based Transformations option for a file. Supported values are 0 (disabled) and 1 (enabled). Default 1 (enabled).
option_ad no bool Ad option for a file. Supported values are 0 (disabled), 1 (enabled) and 2 (new). Default 1 (enabled).
wm no string Unique alphanumeric id of watermark. Default null

List Files


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// list files
$response = $publitio_api->call("/files/list", "GET");

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/files/list?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// list files
publitio.call('/files/list', 'GET', { offset: '0', limit: '10' })
    .then((data) => { console.log(data) })
    .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "limit": 100,
    "offset": 0,
    "files_total": 2,
    "files_count": 2,
    "files": [
        {
            "id": "RVsbVdyp",
            "public_id": null,
            "title": "rasa1",
            "description": "",
            "tags": "",
            "type": "image",
            "extension": "jpg",
            "size": 77008,
            "width": 1000,
            "height": 667,
            "privacy": "public",
            "option_download": "enabled",
            "option_ad": "enabled",
            "option_transform": "enabled",
            "wm_id": null,
            "url_preview": "https://media.publit.io/file/RVsbVdyp.jpg",
            "url_download": "https://media.publit.io/download/RVsbVdyp.jpg?at=eyJpdiI6Ik5XT2t2QkRkeHNiUmxJZDR6QTBGcEE9PSIsInZhbHVlIjoiN01CXC9WYWxGdGRBZ29wak1jXC80d1B0TlVIWko0OCtIbjB3VXZIM0J2ZHlNPSIsIm1hYyI6IjA2MGFjYzI1Y2U0MTFkMzZmMGQyNjdmNTM0Mjk1MzI1NjQzZjk1ZmY2ODE4N2NhODRmYjE1MTZmZTgwY2VlOTgifQ==",
            "versions": 1,
            "hits": 13,
            "created_at": "2017-11-22 15:48:13",
            "updated_at": "2017-12-20 11:26:59"
        },
        {
            "id": "oZTuvJmJ",
            "public_id": null,
            "title": "rasa2",
            "description": "",
            "tags": "",
            "type": "image",
            "extension": "jpg",
            "size": 77785,
            "width": 1000,
            "height": 665,
            "privacy": "public",
            "option_download": "enabled",
            "option_ad": "enabled",
            "option_transform": "enabled",
            "wm_id": null,
            "url_preview": "https://media.publit.io/file/oZTuvJmJ.jpg",
            "url_download": "https://media.publit.io/download/oZTuvJmJ.jpg?at=eyJpdiI6IkZBU0VzSDZFZkFuYzdOcmZ0a213MVE9PSIsInZhbHVlIjoiT0R3K2FRZ2cxU1huUlpiNzFURDJkN3pBeTVxMzJMZTRRWjV3U3dEc21ncz0iLCJtYWMiOiJiZjQwODk0NmZkZThjYTQ0MzQ4MzU4NmFiNzgxNzRhYzE5ZWFhZTA4YWM5Mzg3MTYyOGFhYjlhMWMyOWU5NmUxIn0=",
            "versions": 1,
            "hits": 5,
            "created_at": "2017-11-22 15:48:14",
            "updated_at": "2017-12-20 11:27:30"
        }              
    ]
}
]

This endpoint retrieves list of files.

HTTP Request

GET https://api.publit.io/v1/files/list

Query Parameters

Parameter Required Type Description
limit no int Specifies maximum number of files to return. Default is 100. Maximum result limit is 1000
offset no int Specifies how many files should be skipped at the beginning of the result set. Default is 0
order no string Specifies parameters by which returned result should be ordered. Supported values are date, name, size and hits. Parameter sort order can be specified by appending :asc for an ascending sort order or :desc for a descending one to the parameter name (for example name:desc). Default sort order is ascending and can be omitted. Default is date
filter_privacy no string Specifies which files should be returned based on privacy status. Supported values are all, private and public. Default is all
filter_extension no string Specifies which files should be returned based on extension (output format). For full list see List of supported extensions. Default is all
filter_type no string Specifies which files should be returned based on their type. Supported values are all, image and video. Default is all
filter_ad no string Specifies which files should be returned based on option_ad status. Supported values are all, enabled, disabled and new. Default is all
tags no string Specifies tags by whic to perform search via query. Tag mode can be specified by appending :any (a file will be listed if it has at least one tag specified in the tags parameter.) or by appending :all (a file will only be listed if it has all tags specified in the tags parameter). Default mode is all. Formated tags query could look like this doggs+cats:any

Show File


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// show file with id mytestfile
$response = $publitio_api->call("/files/show/mytestfile", "GET"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/files/show/mytestfile?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// show file with id mytestfile
publitio.call('/files/show/mytestfile', 'GET')
    .then((data) => { console.log(data) })
    .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "id": "RVsbVdyp",
    "public_id": null,
    "title": "rasa1",
    "description": "",
    "tags": "",
    "type": "image",
    "extension": "jpg",
    "size": 77008,
    "width": 1000,
    "height": 667,
    "privacy": "public",
    "option_download": "enabled",
    "option_ad": "enabled",
    "option_transform": "enabled",
    "wm_id": null,
    "url_preview": "https://media.publit.io/file/RVsbVdyp.jpg",
    "url_download": "https://media.publit.io/download/RVsbVdyp.jpg?at=eyJpdiI6IkhHK0o2SUp0Rmw0Ynh6WVU2T1diV2c9PSIsInZhbHVlIjoidlFcL3RERUZRaWRmbWVsTG9BQWdyTXozQWprR1VhSGVLN3RMR3RxUVVSd1k9IiwibWFjIjoiY2ZjNGQ2YmUzM2JiYzQ2YzRhZjkzMDRhMDY3NjBjNzNmMmM3YzZkMTlkN2ZkMDA4NGZkOTI1ZGJhZWQzMzI2YyJ9",
    "versions": 2,
    "hits": 14,
    "created_at": "2017-11-22 15:48:13",
    "updated_at": "2018-01-10 16:00:22"
  }
]

This endpoint shows specific file info based on it's id.

HTTP Request

GET https://api.publit.io/v1/files/show/<file_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of file.

Update File


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// update file with id mytestfile
$response = $publitio_api->call("/files/update/mytestfile", "PUT", 
    array('position' => 'top-left', 
          'padding' => '10')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X PUT "https://api.publit.io/v1/files/update/mytestfile?{{api_signature}}" \
-H "Accept: application/json" \
--data title="New File Title" \
--data description="This id file description..."

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// update file with id mytestfile
publitio.call('/files/update/mytestfile', 'PUT', {
   title: 'some title',
   description: 'dome desc',
   tags: 'tag1 tag2',
   privacy: '1',
   option_download: '1',
   option_ad: '1'
}).then((data) => { console.log(data) })
   .catch((error) => { console.log(error) }) 

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The file with with id 'mytestfile' has been updated"
  }
]

This endpoint update specific file info based on it's id.

HTTP Request

PUT https://api.publit.io/v1/files/update/<file_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of file.
public_id no string Unique alphanumeric public id of file. Default null
title no string Title of uploaded file. Default taken from file name.
description no string Optional description of file.
tags no string Optional tags for file. Used for search.
privacy no bool Privacy for file. Supported values are 0 (private) and 1 (public). Default 0 (private).
option_download no bool Download option for a file. Supported values are 0 (disabled) and 1 (enabled). Default 1 (enabled).
option_transform no bool Url-based Transformations option for a file. Supported values are 0 (disabled) and 1 (enabled). Default 1 (enabled).
option_ad no bool Ad option for a file. Supported values are 0 (disabled), 1 (enabled) and 2 (new). Default 1 (enabled).

Delete File


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// delete file with id mytestfile
$response = $publitio_api->call("/files/delete/mytestfile", "DELETE"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X DELETE "https://api.publit.io/v1/files/delete/mytestfile?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// delete file with id mytestfile
publitio.call('/files/delete/mytestfile', 'DELETE')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The file with id 'mytestfile' has been deleted!"
  }
]

This endpoint deletes specific file info based on it's id.

HTTP Request

DELETE https://api.publit.io/v1/files/delete/<file_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of file.

Player File


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// show file with id mytestfile
$response = $publitio_api->call("/files/player/mytestfile", "GET"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/files/player/mytestfile?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// get player for file with id mytestfile
publitio.call('/files/player/mytestfile', 'GET', {
   player: 'id',
   adtag: 'id'
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "player_html": "<div id=\"publitio_RVsbVdyp\" class=\"publitioPlayer\" ><div id=\"publitio_ph_RVsbVdyp\" class=\"publitioPlaceHolder\" ><div id=\"publitio_phb_RVsbVdyp\" class=\"publitioPlaceHolderBtn\" ></div><img class=\"publitioPlaceHolderImg\" src=\"https://media.publit.io/file/RVsbVdyp.jpg\" ></div></div><link href=\"http://static.publit.io/css/publitio_player.min.css\" rel=\"stylesheet\" /><script src=\"http://static.publit.io/js/publitio_player.min.js\"></script><script src=\"//imasdk.googleapis.com/js/sdkloader/ima3.js\"></script><script type=\"text/javascript\">var publitio_RVsbVdyp = new Publitio({id: \"RVsbVdyp\", width: \"1000\", height: \"667\", fileSources: {mp4:\"https://media.publit.io/file/RVsbVdyp.mp4\", webm:\"https://media.publit.io/file/RVsbVdyp.webm\", ogv:\"https://media.publit.io/file/RVsbVdyp.ogv\", jpg:\"https://media.publit.io/file/RVsbVdyp.jpg\"}, adTag: \"\", autoPlay: 0, controlBar: \"false\", playerSkin: \"grey\"});</script>",
    "source_html": "<img src=\"http://media.publit.io/file/w_640/RVsbVdyp.jpg\" srcset=\"http://media.publit.io/file/w_320/RVsbVdyp.jpg 320w, http://media.publit.io/file/w_640/RVsbVdyp.jpg 640w\" sizes=\"100vw\" alt=\"xoxoxo\" />"
  }
]

This endpoint formats HTML5 Media Player for specific file info based on its id. It also returns source_html that you can insert directly into your html as media elements.

HTTP Request

GET https://api.publit.io/v1/files/player/<file_id>

Query Parameters

Parameter Required Type Description
player yes string Unique alphanumeric name (id) of player.
adtag no string Unique alphanumeric name (id) of adtag to load with player.
adtag_url no string Url to VAST/IMA adtag to load with player (overites adtag param).
auto_play no int Auto play content (overites player auto_play setting). Supported values 0 (off), 1 (on) and 2 (onmouseover)

Versions

Versions Class (Sub-class of Files) allows easy creation and management of the derived versions of your uploaded Files. With it you can do transformations, transcoding betwean formats, croping, resizing, watermarking, do quality ajustment, etc.

Create Version


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// create new version from file with id mytestfile, with options width=320, height=240, crop=fill
$response = $publitio_api->call("/files/versions/create/mytestfile", "POST", 
    array('extension' => 'mp4', 
          'options' => 'w_320,h_240,c_fill')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X POST "https://api.publit.io/v1/files/versions/create/mytestfile?{{api_signature}}" \
-H "Accept: application/json" \
--data extension="mp4" \
--data options="w_320,h_240,c_fill"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// create new version from file with id mytestfile, with options width=320, height=240, crop=fit
publitio.call('/files/versions/create/mytestfile', 'POST', {
   extension: 'mp4',
   options: 'w_320,h_240,c_fit'
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) }) 

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 201,
    "message": "File version created",
    "id": "JR78dfTh",
    "file_id": "RVsbVdyp",
    "extension": "png",
    "options": "h_250,w_250",
    "size": 90711,
    "status": "ready",
    "url": "https://media.publit.io/file/h_250,w_250/RVsbVdyp.png",
    "hits": 0,
    "created_at": "2018-01-10 16:00:19",
    "updated_at": "2018-01-10 16:00:21"
  }
]

This endpoint creates new file version, out of your original file. You can use it to transcode your files betwean formats, for resizing, croping, watermarking and/or quality ajustment.

HTTP Request

POST https://api.publit.io/v1/files/versions/create/<file_id>

Query Parameters

Parameter Required Type Description
id yes string Original file id you wish to transform.
extension yes string Extension (output format) of desired file version. For supported list please see below.
options yes string List of options you want to apply to this transformation. For supported list please see below.

List of extensions (output formats)

With Publitio API you can easily transcode your files between formats. Supported extensions (output formats) are:

List of options for transformations

Publitio API supports following image & video manipulations/transformations: resizing, cropping, watermarking, quality ajustment and triming (videos only). Here is a guide how to use each of these options:

For resizing, please use w (width) and h (height) parameters. Both w and h accepts integer values. For example, w_250 sets the width to exactly 250 pixels. You can resize the file by using both the width and height parameters or with only one of them: the other dimension is automatically updated to maintain the aspect ratio. For example, to resize image or video to 800x600 pixels, format option as w_800,h_600

For cropping, please use c (crop) parameter in comination with w (width) and h (height) parameters. Supported values are c_fit (fit), c_fill (fill) and c_limit (limit).

For watermarking of images & videos, use wm param. For example, to protect your file with watermark with id publitio format option as wm_publitio. You can use wm in combination with w, h and c params, for example format option as w_800,h_600,c_fill,wm_publitio

For quality ajustment of images & videos, use q param. This parameter represents the compression level to apply to an image or videos as a value between 1 (smallest file size possible) and 100 (best visual quality). For example, to reduce the quality of the file version to 60, please use q_60 option. You can use q in combination with w, h, c and wm params as well, for example format option as w_800,h_600,c_fill,wm_publitio,q_60

For trimming of videos, use t (time), so (start offset) and eo (end offset) params.

List Versions


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// list versions for file with id mytestfile
$response = $publitio_api->call("/files/versions/list/mytestfile", "GET");

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/files/versions/list/mytestfile?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// list versions for file with id mytestfile
publitio.call('/files/versions/list/mytestfile', 'GET')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "limit": 100,
    "offset": 0,
    "versions_total": 2,
    "versions_count": 2,
    "versions": [
        {
            "id": "zoq6qNQy",
            "file_id": "RVsbVdyp",
            "extension": "mp4",
            "options": "",
            "size": 193136,
            "status": "ready",
            "url": "https://media.publit.io/file/RVsbVdyp.mp4",
            "hits": 14,
            "created_at": "2017-11-22 15:48:19",
            "updated_at": "2018-01-08 11:25:54"
        },
        {
            "id": "JR78dfTh",
            "file_id": "RVsbVdyp",
            "extension": "png",
            "options": "h_250,w_250",
            "size": 90711,
            "status": "ready",
            "url": "https://media.publit.io/file/h_250,w_250/RVsbVdyp.png",
            "hits": 0,
            "created_at": "2018-01-10 16:00:19",
            "updated_at": "2018-01-10 16:00:21"
        }
    ]
  }
]

This endpoint lists all versions for specific file.

HTTP Request

GET https://api.publit.io/v1/files/versions/list/<file_id>

Query Parameters

Parameter Required Type Description
id yes string Original file id you wish to retrieve versions for.
limit no int Specifies maximum number of file versions to return. Default is 100. Maximum result limit is 1000
offset no int Specifies how many file versions should be skipped at the beginning of the result set. Default is 0
order no string Specifies parameters by which returned result should be ordered. Supported values are date, name, size and hits. Parameter sort order can be specified by appending :asc for an ascending sort order or :desc for a descending one to the parameter name (for example name:desc). Default sort order is ascending and can be omitted. Default is date
filter_status no string Specifies which file versions should be returned based on transformation status. Supported values are all, creating, ready and failed. Default is all
filter_extension no string Specifies which file versions should be returned based on extension (output format). For full list see List of extensions. Default is all

Show Version


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// show file version with id zoq6qNQy
$response = $publitio_api->call("/files/versions/show/zoq6qNQy", "GET"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/files/versions/show/zoq6qNQy?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// show file version with id zoq6qNQy
publitio.call('/files/versions/show/zoq6qNQy', 'GET')
  .then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "id": "zoq6qNQy",
    "file_id": "RVsbVdyp",
    "extension": "mp4",
    "options": "",
    "size": 193136,
    "status": "ready",
    "url": "https://media.publit.io/file/RVsbVdyp.mp4",
    "hits": 14,
    "created_at": "2017-11-22 15:48:19",
    "updated_at": "2018-01-08 11:25:54"
  }
]

This endpoint shows specific file version info based on it's id.

HTTP Request

GET https://api.publit.io/v1/files/versions/show/<version_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of version.

Update Version


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// update file version with id zoq6qNQy
$response = $publitio_api->call("/files/versions/update/zoq6qNQy", "PUT", array()); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X PUT "https://api.publit.io/v1/files/versions/update/zoq6qNQy?{{api_signature}}" \
-H "Accept: application/json" 

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// update file version with id zoq6qNQy
publitio.call('/files/versions/update/zoq6qNQy', 'PUT', {})
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The file version with id 'zoq6qNQy' has been updated"
  }
]

This endpoint updates specific file version info based on it's id.

HTTP Request

PUT https://api.publit.io/v1/files/versions/update/<version_id>

Query Parameters

This api call does not support any param at this moment.

Delete Version


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// delete file version with id zoq6qNQy
$response = $publitio_api->call("/files/versions/delete/zoq6qNQy", "DELETE"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X DELETE "https://api.publit.io/v1/files/versions/delete/zoq6qNQy?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// delete file version with id zoq6qNQy
publitio.call('/files/versions/delete/zoq6qNQy', 'DELETE')
  .then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The file version with id 'zoq6qNQy' has been deleted!"
  }
]

This endpoint deletes specific file version based on it's id.

HTTP Request

GET https://api.publit.io/v1/files/versions/delete/<version_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric id of version.

Players

Players Class allows easy creation and management of the HTML5 Media Players that you can use to play/preview your uploaded Files & Versions.

Create Player


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// create player with name (id) myplayer
$response = $publitio_api->call("/players/create", "POST", 
    array('name' => 'myplayer', 
          'auto_play' => '0',
          'skin' => 'blue')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X POST "https://api.publit.io/v1/players/create?{{api_signature}}" \
-H "Accept: application/json" \
--data name="myplayer" \
--data auto_play="0" \
--data skin="blue"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// create player with id myplayer
publitio.call('/players/create', 'POST', {
   name: 'myplayer',
   auto_play: '0', 
   skin: 'blue'
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 201,
    "message": "Player with name (id) 'myplayer' created",
    "id": "myplayer",
    "auto_play": 0,
    "skin": "blue",
    "adtag_id": "",
    "created_at": "2018-01-10 14:56:52",
    "updated_at": "2018-01-10 14:56:52"
  }
]

This endpoint creates new HTML5 Media Player, that you can later use to play/preview your Files & Versions.

HTTP Request

POST https://api.publit.io/v1/players/create

Query Parameters

Parameter Required Type Description
name yes string Unique alphanumeric name (id) of player.
auto_play no int Autoplay option for player, valid 0 (off), 1 (on), 2 (on mouseover). Default 0.
skin no string Skin for player. Valid values are: blue, pink, green, grey, orange and inverted. Default grey.
adtag_id no string Unique alphanumeric name (id) of adtag you want to use with this player.

List Players


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// list players
$response = $publitio_api->call("/players/list", "GET");

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/players/list?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// list players
publitio.call('/players/list', 'GET')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "players_count": 2,
    "players": [
        {
            "id": "myplayer",
            "auto_play": 0,
            "skin": "blue",
            "adtag_id": "",
            "created_at": "2017-11-29 17:50:36",
            "updated_at": "2017-11-29 17:50:36"
        },
        {
            "id": "publitio",
            "auto_play": 1,
            "skin": "grey",
            "adtag_id": "preroll",
            "created_at": "2017-12-19 10:26:15",
            "updated_at": "2017-12-19 10:26:15"
        }
    ]
  }
]

This endpoint lists all players under the account.

HTTP Request

GET https://api.publit.io/v1/players/list

Query Parameters

No query parameters are required/supported for this api call at this moment.

Show Player


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// show player with id myplayer
$response = $publitio_api->call("/players/show/myplayer", "GET"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/players/show/myplayer?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// show player with id myplayer
publitio.call('/players/show/myplayer', 'GET')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "id": "myplayer",
    "auto_play": 0,
    "skin": "blue",
    "adtag_id": "",
    "created_at": "2018-01-10 14:56:52",
    "updated_at": "2018-01-10 14:56:52"
  }
]

This endpoint shows specific player info based on it's id.

HTTP Request

GET https://api.publit.io/v1/players/show/<player_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of player.

Update Player


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// update player with id mytestwm
$response = $publitio_api->call("/players/update/myplayer", "PUT", 
    array('auto_play' => '2', 
          'skin' => 'orange', 
          'adtag_id' => 'myadtag')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X PUT "https://api.publit.io/v1/players/update/myplayer?{{api_signature}}" \
-H "Accept: application/json" \
--data auto_play="2" \
--data skin="orange" \
--data adtag_id="myadtag"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// update player with id myplayer
publitio.call('/players/update/myplayer', 'PUT', {
   adtag_id: 'mypreroll',
   auto_play: '1',
   skin: ''
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The player with name (id) 'myplayer' has been updated"
  }
]

This endpoint update specific player info based on it's id.

HTTP Request

PUT https://api.publit.io/v1/players/update/<player_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of player.
auto_play no int Autoplay option for player, valid 0 (off), 1 (on), 2 (on mouseover). Default 0.
skin no string Skin for player. Valid values are: blue, pink, green, grey, orange and inverted. Default grey.
adtag_id no string Unique alphanumeric name (id) of adtag you want to use with this player.

Delete Player


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// delete player with id myplayer
$response = $publitio_api->call("/players/delete/myplayer", "DELETE"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X DELETE "https://api.publit.io/v1/players/delete/myplayer?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// delete player with id myplayer
publitio.call('/players/delete/myplayer', 'DELETE')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The player with name (id) 'myplayer' has been deleted!"
  }
]

This endpoint deletes specific player info based on it's id.

HTTP Request

GET https://api.publit.io/v1/players/delete/<player_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of player.

Adtags

AdTags Class (Sub-class of Players) allows easy creation and management of the VAST/IMA Ad Tags that you can use with your Players to monetize your Files & Versions with ads.

Create Adtag


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// create adtag with name (id) myadtag
$response = $publitio_api->call("/players/adtag/create", "POST", 
    array('name' => 'myadtag', 
          'tag' => 'https://pubads.g.doubleclick.net/gampad/ads?sz=480x70&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dnonlinear&correlator=')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X POST "https://api.publit.io/v1/players/create?{{api_signature}}" \
-H "Accept: application/json" \
--data name="myadtag" \
--data tag="https://pubads.g.doubleclick.net/gampad/ads?sz=480x70&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dnonlinear&correlator="

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// create adtag with id myadtag
publitio.call('/players/adtags/create', 'POST', {
   name: 'myadtag',
   tag: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator='
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 201,
    "message": "Adtag with name (id) 'myadtag' created",
    "id": "myadtag",
    "tag": "https://pubads.g.doubleclick.net/gampad/ads?sz=480x70&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dnonlinear&correlator=",
    "created_at": "2018-01-10 15:26:01",
    "updated_at": "2018-01-10 15:26:01"
 }
]

This endpoint creates new VAST/IMA Ad Tag that you can later use with your Players to monetize your Files & Versions with ads. You can get sample tags for testing at Google IMA Sample Tags

HTTP Request

POST https://api.publit.io/v1/players/adtags/create

Query Parameters

Parameter Required Type Description
name yes string Unique alphanumeric name (id) of adtag.
tag yes string Tag url you wish to use. Publitio Player supports VAST & Google IMA ad tags at the moment.

List Adtags


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// list adtags
$response = $publitio_api->call("/players/adtags/list", "GET");

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/players/adtags/list?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// list adtags
publitio.call('/players/adtags/list', 'GET')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "adtags_count": 2,
    "adtags": [
        {
            "id": "preroll",
            "tag": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=",
            "created_at": "2017-12-19 10:23:51",
            "updated_at": "2017-12-19 10:23:51"
        },
        {
            "id": "myadtag",
            "tag": "https://pubads.g.doubleclick.net/gampad/ads?sz=480x70&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dnonlinear&correlator=",
            "created_at": "2018-01-10 15:26:01",
            "updated_at": "2018-01-10 15:26:01"
        }
    ]
  }
]

This endpoint lists all adtags under the account.

HTTP Request

GET https://api.publit.io/v1/players/adtags/list

Query Parameters

No query parameters are required/supported for this api call at this moment.

Show Adtag


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// show adtag with id myadtag
$response = $publitio_api->call("/players/adtags/show/myadtag", "GET"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/players/adtags/show/myadtag?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// show adtag with id myadtag
publitio.call('/players/adtags/show/myadtag', 'GET')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "id": "myadtag",
    "tag": "https://pubads.g.doubleclick.net/gampad/ads?sz=480x70&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dnonlinear&correlator=",
    "created_at": "2018-01-10 15:26:01",
    "updated_at": "2018-01-10 15:26:01"
  }
]

This endpoint shows specific adtag info based on it's id.

HTTP Request

GET https://api.publit.io/v1/players/adtags/show/<adtag_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of adtag.

Update Adtag


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// update adtag with id myadtag
$response = $publitio_api->call("/players/adtags/update/myadtag", "PUT", 
    array('tag' => 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X PUT "https://api.publit.io/v1/players/adtags/update/myadtag?{{api_signature}}" \
-H "Accept: application/json" \
--data tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=" 

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// update adtag with id myadtag
publitio.call('/players/adtags/update/myadtag', 'PUT', {
   tag: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator='
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) }) 

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The adtag with name (id) 'myadtag' has been updated"
  }
]

This endpoint update specific adtag info based on it's id.

HTTP Request

PUT https://api.publit.io/v1/players/adtags/update/<adtag_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of adtag.
tag no string Tag url you wish to use. Publitio Player supports VAST & Google IMA ad tags at the moment.

Delete Adtag


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// delete adtag with id myadtag
$response = $publitio_api->call("/players/adtags/delete/myadtag", "DELETE"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X DELETE "https://api.publit.io/v1/players/adtags/delete/myadtag?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// delete adtag with id myadtag
publitio.call('/players/adtags/delete/myadtag', 'DELETE')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The adtag with name (id) 'myadtag' has been deleted!"
  }
]

This endpoint deletes specific adtag info based on it's id.

HTTP Request

GET https://api.publit.io/v1/players/adtags/delete/<adtag_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of adtag.

Watermarks

Watermarks Class allows easy creation and management of the watermarks that you can use to protect/copyright your uploaded Files & Versions.

Create Watermark


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// create (upload) watermark from local file
$response = $publitio_api->upload_file("samples/smile.png", "watermark", 
    array('name' => 'mytestwm', 
          'position' => 'top-right', 
          'padding' => '20')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X POST "https://api.publit.io/v1/watermarks/create?{{api_signature}}" \
-H "Accept: application/json" \
--form name=mytestwm \
--form position=top-right \
--form padding=20 \
--form file=@/localpathtoimage/watermark.png

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// create (upload) watermark from local file
pubitio.uploadFile(file, 'watermark', {
   name: 'mytestwm',
   position: 'top-right',
   padding: '20'
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 201,
    "message": "Watermark created",
    "id": "mytestwm",
    "extension": "png",
    "width": 100,
    "height": 100,
    "size": 3198,
    "position": "top-right",
    "padding": 20,
    "url": "https://media.publit.io/watermark/c74i.png",
    "created_at": "2018-01-10 12:21:32",
    "updated_at": "2018-01-10 12:21:32"
  }
]

This endpoint creates new watermark, that you can later use on Files & Versions in order to protect your images and videos. Right now you can upload png or jpg images as your watermarks and Publitio API will securely stored them for future use.

HTTP Request

POST https://api.publit.io/v1/watermarks/create

Query Parameters

Parameter Required Type Description
file yes file Image to upload as watermark (png or jpg supported) .
name yes string Unique alphanumeric name (id) of watermark.
position no string Position of watermark, valid center, top-left, top, top-right, left, right, bottom-left, bottom, bottom-right. Default bottom-right.
padding no int Padding in pixels (ignored for Position center). Default 0.

List Watermarks


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// list watermarks
$response = $publitio_api->call("/watermarks/list", "GET");

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/watermarks/list?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// list watermarks
publitio.call('/watermarks/list', 'GET')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "watermarks_count": 2,
    "watermarks": [
        {
            "id": "publitio",
            "extension": "png",
            "width": 150,
            "height": 49,
            "size": 3388,
            "position": "top-right",
            "padding": 10,
            "url": "https://media.publit.io/watermark/69ty.png",
            "created_at": "2017-11-29 16:49:26",
            "updated_at": "2017-11-29 16:49:26"
        },
        {
            "id": "mytestwm",
            "extension": "png",
            "width": 100,
            "height": 100,
            "size": 3198,
            "position": "top-right",
            "padding": 20,
            "url": "https://media.publit.io/watermark/c74i.png",            
            "created_at": "2018-01-10 12:21:32",
            "updated_at": "2018-01-10 12:21:32"
        }
    ]
  }
]

This endpoint lists all watermark under the account.

HTTP Request

GET https://api.publit.io/v1/watermarks/list

Query Parameters

No query parameters are required/supported for this api call at this moment.

Show Watermark


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// show watermark with id mytestwm
$response = $publitio_api->call("/watermarks/show/mytestwm", "GET"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X GET "https://api.publit.io/v1/watermarks/show/mytestwm?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// show watermark with id mytestwm
publitio.call('/watermarks/show/mytestwm', 'GET')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "id": "mytestwm",
    "extension": "png",
    "width": 100,
    "height": 100,
    "size": 3056,
    "position": "top-right",
    "padding": 20,
    "url": "https://media.publit.io/watermark/c74i.png",
    "created_at": "2018-01-10 13:04:45",
    "updated_at": "2018-01-10 13:04:45"
 }
]

This endpoint shows specific watermark info based on it's id.

HTTP Request

GET https://api.publit.io/v1/watermarks/show/<watermark_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of watermark.

Update Watermark


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// update watermark with id mytestwm
$response = $publitio_api->call("/watermarks/update/mytestwm", "PUT", 
    array('position' => 'top-left', 
          'padding' => '10')
); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X PUT "https://api.publit.io/v1/watermarks/update/mytestwm?{{api_signature}}" \
-H "Accept: application/json" \
--data padding="25" \
--data position="top-left"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// update watermark with id mytestwm
publitio.call('/watermarks/update/mytestwm', 'PUT', {
   position: 'bottom-right',
   padding: '10'
}).then((data) => { console.log(data) })
  .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The watermark with name (id) 'mytestwm' has been updated"
  }
]

This endpoint update specific watermark info based on it's id.

HTTP Request

PUT https://api.publit.io/v1/watermarks/update/<watermark_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of watermark.
position no string Position of watermark, valid center, top-left, top, top-right, left, right, bottom-left, bottom, bottom-right. Default bottom-right.
padding no int Padding in pixels (ignored for Position center). Default 0.

Delete Watermark


// Download PHP SDK from https://github.com/ob1y2k/publitio_php_sdk
require_once('publitio_api.php'); 
// Please update xxxx with your key and yyyy with your secret
$publitio_api = new PublitioAPI(
    'xxxx',
    'yyyy'
);

// delete watermark with id mytestwm
$response = $publitio_api->call("/watermarks/delete/mytestwm", "DELETE"); 

//echo entire response
print_r($response);

#please replace {{api_signature}} with you api signature
curl -X DELETE "https://api.publit.io/v1/watermarks/delete/mytestwm?{{api_signature}}" \
-H "Accept: application/json"

// Download JavaScript SDK from https://github.com/ob1y2k/publitio_js_sdk

// Include SDK
import { publitioApi } from 'publitio_js_sdk'
window.publitioApi = publitioApi

// Please update xxxx with your key and yyyy with your secret
publitio = publitioApi("xxxx","yyyy");

// delete watermark with id mytestwm
publitio.call('/watermarks/delete/mytestwm', 'DELETE')
   .then((data) => { console.log(data) })
   .catch((error) => { console.log(error) })

The above command returns JSON structured like this:

[
  {
    "success": true,
    "code": 200,
    "message": "The watermark with name (id) 'mytestwm' has been deleted!"
  }
]

This endpoint deletes specific watermark info based on it's id.

HTTP Request

GET https://api.publit.io/v1/watermarks/delete/<watermark_id>

Query Parameters

Parameter Required Type Description
id yes string Unique alphanumeric name (id) of watermark.

Wrappers

Wrapper code looks like this:

<script type="text/javascript">
    // global wrapper options
    var WrapperOptions = {
        //change class_id with your target class id (ex: <div class="images"><img src="picture.jpg"></div>)
        class_id: "images", 
        // replace adtag_url with your VAST or Google IMA tag
        adtag_url: "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=",
        // 0 - off ; 1 - on ; 2 - on mouseover for auto_play
        auto_play: 2, 
        // true or false for lazy loading of multiple images
        lazy_loading: true  
    };
    (function() {
        var wrapp = document.createElement("script"); 
        wrapp.type = "text/javascript"; 
        wrapp.async = false;
        wrapp.src = "//api.publit.io/assets/js/wrapper_orHm6q9u.js";
        var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(wrapp, s);
    })();
</script>

Wrappers are small javascript codes that can help you with monetization of media (videos & images) on your website.

You get the script code, copy it to footer of your web page, and you can start playing interactive media ads within your videos & images.

It is an video ad solution, that simplifies integration with Google IMA & VAST tags through Publitio Media Player

You can see example of wrapper in action here : http://keepdsmile.com/publitio/espreso.php

Wrapper basically fetches targeted videos & images and turns them into interactive media (video) elements, that can have both pre-roll and overly ads within them. You can read more about Wrappers media monetization solution at our blog

Creating Wrappers

You can create wrappers at Publitio Dashboard Wrapper page in 3 easy steps:

  1. Add domain/site
  2. Get the javascript code
  3. Paste code to footer of your website & configure options

Wrapper Options

Parameter Required Type Description
class_id yes class Target html class with images (ex: <div class=/"images/"><img src=/"picture.jpg/">) .
adtag_url yes url Your VAST or Google IMA tag
auto_play no number 0 - off ; 1 - on ; 2 - on mouseover.
lazy_loading no bool true or false for lazy loading of multiple images.

URL-Based Transformations

Publitio offers URL-Based form of API through which you can do all the file transformations on the fly & instantly, just over the browser, by changing the parameters in the file url. You can use it to transcode your files betwean formats, for resizing, croping, trimming, watermarking and/or quality ajustment.

Idea is identical to Create Version method: you pass on options and extension (as a output format) to the file url and new file version will be created on the fly.

https://media.publit.io/file/<options>/<file_id>.<extension>

For full list of supported options and extension please see Create Version method or follow examples bellow.

List of extensions (output formats)

For transcoding of files between formats, use following extension (output format):

List of options for transformations

As of options, you can use the following: w (width) and h for resizing, c (crop) for cropping, wm (watermark) for watermarking and q (quality) for quality ajustment. For trimming of videos, use t (time), so (start offset) and eo (end offset) params.

Samples files

This is our sample image of Butterflies: https://media.publit.io/file/butterflies.jpg

alt text

And our sample video Tummy: https://media.publit.io/file/tummy.mp4


Lets see on few example how to use options and extensions params to do various transformations:

Resizing

To resize sample image or video to 600px in width append w_600 to url as in:

https://media.publit.io/file/w_600/butterflies.jpg

alt text

To resize sample image to 400x400px in size append w_400,h_400 to url as in:

https://media.publit.io/file/w_400,h_400/butterflies.jpg

alt text

Cropping

For cropping, please use c (crop) parameter in comination with w (width) and h (height) parameters. Supported values are c_fit (fit), c_fill (fill) and c_limit (limit).

c_fill will resize image or video to exact given width and height while retaining the original aspect ratio, using only part of the original file that fills the given dimensions if necessary.

To create 300x300 thumb out of our sample image with c_fill, append w_300,h_300,c_fill to url as in:

https://media.publit.io/file/w_300,h_300,c_fill/butterflies.jpg

alt text

c_fit, will resize file so that it takes up as much space as possible within a bounding box defined by the given width and height parameters. The original aspect ratio is retained and all of the original file is visible. To create 300x300 thumb out of our sample image with c_fit, append w_300,h_300,c_fit to url as in:

https://media.publit.io/file/w_300,h_300,c_fit/butterflies.jpg

alt text

c_limit is same as the c_fit mode but only if the original file is larger than the given limit (width and height), in which case the image or video is scaled down so that it takes up as much space as possible within a bounding box defined by the given width and height parameters.

Watermarking

For watermarking of your images and videos use wm option. To watermark our sample image with watermark with id publitio append wm_publitio to url:

https://media.publit.io/file/wm_publitio,w_800/butterflies.jpg

alt text

You can use wm in combination with rest of the options, for example w_800,h_600,c_fill,wm_publitio

Trimming

For trimming (videos only option) please use t (time), so (start offset) and eo (end offset) params.

t should be used for video to image transformation. For example, to get image from 3rd second of video, use t_3 as an option and set extension to jpg in url:

https://media.publit.io/file/t_3,w_800/tummy.jpg

alt text

To create 2 seconds long trimmed video out of original video starting from 2nd second, use so_2,eo_2 in url. so_2 indicates from which second (2) to start trimming and eo_2 is makeing trimmed video 2 seconds in lenght:

https://media.publit.io/file/so_2,eo_2,h_480/tummy.mp4

Transcoding

Here we will show how you can easily do image to image, image to video, video to video, video to image, and video to audio transformations with URL-Based API.

Image to image

To transcode our sample image to png format, we just need to change extension in url like this:

https://media.publit.io/file/butterflies.png

alt text

We can combine different extension with all the options, so for example to create image 500px in width, with watermark and in gif format, we can use w_500,wm_publitio as an option and gif as an extension:

https://media.publit.io/file/w_500,wm_publitio/butterflies.gif

alt text

Image to video

To create mp4 video out of image (usefull for gif files & player integration), change the extension to mp4:

https://media.publit.io/file/w_800/butterflies.mp4

Video to video

Any video you upload can be transcoded to mp4, webm and ogv format.

To create 360p mp4 video out of our original sample Tummy video, format url as in:

https://media.publit.io/file/h_360/tummy.mp4


Transcoding can be done in combination with other available options, so for example to create 480p mp4 watemarked video out of original, we can add to url h_480,wm_publitio and set extension to mp4

https://media.publit.io/file/h_480,wm_publitio/tummy.mp4

Video to image

You can extract image from any part of the video you like. To create png image from 2nd second of video, append t_2 (time = 2 second) to url as follows:

https://media.publit.io/file/t_2/tummy.png

alt text

This can be usefull for generation of thumbnails from the video, just by appending right w (width) and different t (time) options to the urls:

https://media.publit.io/file/t_1,w_200/tummy.png

alt text

https://media.publit.io/file/t_2,w_200/tummy.png

alt text

https://media.publit.io/file/t_3,w_200/tummy.png

alt text

Video to audio

Any video you upload can be transcoded to following audio formats: mp3, wav and ogg.

To create mp3 audio out of our original sample Tummy video, format url as in:

https://media.publit.io/file/tummy.mp3


Video to audio transformations support so and eo params for trimming of audio. To create 2 seconds mp3 audio, startting from 2nd second of video, format url as:

https://media.publit.io/file/so_2,eo_2/tummy.mp3


Quality

Quality ajustment of your images and videos can be controlled through q option. This parameter represents the compression level to apply to an image or videos as a value between 1 (smallest file size possible) and 100 (best visual quality). For example, to reduce the quality of the our sample image to 50, please use q_50 option:

https://media.publit.io/file/q_50/butterflies.jpg

alt text

Download SDK's

Here is a list of SDK's for Publitio API that you can download and do integration with frameworks of your choice. We're working on adding more supported languages asap.

Errors

Most of the errors returned by the API would have a response body in the following form:

[
  {
    "success": false,
    "code": 404,
    "error": {
        "message": "The file with id 'RVsbVdyzp' doesn't exist"
    }
  }
]

The Publitio API might respond with the following HTTP response codes:

Error Code Meaning
400 Bad Request -- Your request sucks
401 Unauthorized -- Your API Signature is wrong
403 Forbidden -- The requested resource is hidden for private only
404 Not Found -- The requested resource could not be found
405 Method Not Allowed -- You tried to access a request with an invalid method
406 Not Acceptable -- You requested a format that isn't json
410 Gone -- The resource requested has been removed from our servers
429 Too Many Requests -- You're making to much requestis! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- Resource or service temporarially unavailable. Please try again later.