Media Platform API (mpAPI) Documentation

mpAPI is a simple set of APIs that offers access to your galleries using a REST like request, feeds (RSS and JSON) requests and simple HTTP POST.

Use the following set of mpAPI to perform:

Cincopa REST API V2 to get/set and manipulate assets and galleries

Cincopa REST API V2 is a simple set of REST based methods that allow you to access almost every aspect of your galleries and assets. Authentication is done with a simple api_token that can be created and deleted per app, set the permission level according to the needed level and exposure level.

V2 API was designed to be used :

  • in server-to-server scenario where the api_token and information is not exposed to the public, in such scenario the permissions level can allow write and delete.
  • in client-to-server scenario like javascript request from a public web page, in this scenario permission level will be set to read only which ensures the safety of your web app. This unique architecture eliminates the need of creating a "proxy" service that usually needed when working with a 3rd party API thus saving you time in integration.

Visit the REST API v2 page where you can get more info about the method and experiment live with them.

Upload content from your site or dashboard using an iFrame

You can upload content to a gallery directly from your web site, this iframe provides a unified simple interface to an end user to uploading using drag and drop, select media, edit the media information, reordering and deleting. The iframe support mobile, tablet and desktop and will adopt the size and shape according the site layout.

Here are some scenarios where this iframe can be used :

  • CMS system like WordPress and BuddyPress in an editor mode where the user can attach the media while in the authoring mode of a post, article or profile. The iframe allows managing and uploading content directly from the dashboard (for example WordPress's Easy Albums plugin).
  • LMS system in teachers mode like moodle.org where the teachers can add media to a lesson
  • CRM system like Salesforce where a media can be attached to any object for example product object where the iframe can be added to the product's layout and allow adding videos, images, audio and docs to that object

Media that is uploaded will reside in a gallery, this gallery can be referenced using 2 methods, those 2 methods are interchangeable and were created to make the integration with the different system much simpler :

  • Cincopa Identifier - this id (also known as FID) is issued by the API (or when creating a gallery in www.cincopa.com). when using FIDs your system should save it either in CMS page (like short code in WordPress) or in an extra field in the CRM object.
  • External Identifier - this id (also knows as RRID) is actually a remote reference given by your system, for example in WordPress this can be post id. in Salesforce this can be the unique id of the specific object.

This is how the iframe will look at your site:

For more information about this method and how to use it check the V2 API doc under method upload.iframe.

Embedding the gallery in your page can be done by adding a javascript or HTML code. When embedding a fix gallery with a know fid (created manually using the Cincopa wizard or obtained with the REST API) use the following code (or copy and paste from step #4 in the wizard) :

<div id="cp_widget_1">...</div>
<script type="text/javascript">
var cpo = [];
cpo["_object"] ="cp_widget_1";
cpo["_fid"] = "<GALLERY_FID>";
var _cpmp = _cpmp || []; _cpmp.push(cpo);
(function() { var cp = document.createElement("script"); cp.type = "text/javascript";
cp.async = true; cp.src = "//www.cincopa.com/media-platform/runtime/libasync.js";
var c = document.getElementsByTagName("script")[0];
c.parentNode.insertBefore(cp, c); })();
</script>

When embedding a gallery with rrid (created by the upload.iframe) use the following code :

<div id="cp_widget_1">...</div> 
<script type="text/javascript"> 
var cpo = []; 
cpo["_object"] ="cp_widget_1"; 
cpo["_uid"] = "<UNIQUE_ACCOUNT_ID>"; 
cpo["_rrid"] = "<REFERENCE_ID >"; 
cpo["_template"] = "<GALLERY_ID>"; 
var _cpmp = _cpmp || []; _cpmp.push(cpo); 
(function() { var cp = document.createElement("script"); cp.type = "text/javascript"; 
cp.async = true; cp.src = "//www.cincopa.com/media-platform/runtime/libasync.js"; 
var c = document.getElementsByTagName("script")[0]; 
c.parentNode.insertBefore(cp, c); })(); 
</script>
Comments about the code :
  • cp_widget_1 in the id of the div and should be unique in the page, if you have more than one then set the second to cp_widget_2 etc. make sure to update
    cpo["_object"] ="cp_widget_2";
    to the same div id
  • UNIQUE_ACCOUNT_ID can be found at the bottom of the API page
  • REFERENCE_ID should be the same as rrid from the iframe
  • GALLERY_ID is the ID of a gallery in your account that will be used as the visual template, create as many templates as your like in your account, call it template1-X, choose the template, customize to your liking and use the ID. you can also use Ids of system templates from the start page for example AEAAQdbniShi

Upload content directly to a gallery or to your account using POST method

You can upload files directly from your app or extenstion using a HTTP POST method.

Click here to get the POST URL to upload to your account. To upload an asset directly to a gallery use the upload_url returned from the gallery.list.json command.

Successful POST will return the following, where in this case the new resource ID is AEyCfY7ET4hA :
authentication ok
file received ok
reading metadata ok
file stored ok
creating resource ok
new resource id 196481794 AEyCfY7ET4hA
done.

Upload content directly to a gallery using an regular email client

Email is a great way to upload content to your account or directly to a gallery. You can give this unique email address to your designer or even distribute to your users.

The unique email address can be found in your upload page at the bottom tab.

Using feeds (RSS/JSON/XSPF) to get gallery content

Follow this link for more info.

Using Cincopa Video and Audio player in a single mode

All Cincopa video and audio players can work in a gallery mode and a single mode. Single mode is useful if you like to dynamically embed a player without pre-creating a gallery, like in the case of using the API.
The embed code (both html and iframe code that you get in step 4 of the wizard) are the same except for the fid parameter. fid parameter syntax is TEMPLATE_ID!ASSET_ID
TEMPLATE_ID - is an ID of a gallery in your account that will be used to draw the player, create this gallery from any template that you like, customize it and test it.
ASSET_ID - is the ID of the asset that you would like to play in the player. Get this ID from the assets page or dynamically from from assets.search API request under drid attribute.

For example, in this iframe code the TEMPLATE_ID is AIBASXc7-7zv and the video ASSET_ID is Ag0Cqq6ltcaH:

<iframe width="600" height="430" src="//www.cincopa.com/media-platform/iframe.aspx?fid=AIBASXc7-7zv!Ag0Cqq6ltcaH" frameborder="0" allowfullscreen scrolling="no"></iframe>