Developer API

AS Media Solutions offers a JSON/JSONP developer API for custom implementations of the content locking mechanism.

How to enable the API

To enable the API access, log in to the AS Media Solutions dashboard and go to "My Account". Click the "Enable API" button. An API Key will be generated for your account. This key is needed in order to make requests and connect them with your account.

JavaScript SDK

The AS Media Solutions JavaScript SDK allows integration with custom locker solutions for any website with minimal coding skills. To start using the JavaScript SDK include it on the page where you wish to use it right after jQuery, which is required. The latest version is available on the following URL:

Getting offers and checking for completion

Initialize the AS Media Solutions API using the code from the example below. Replace the API_KEY with your API Key and LOCKER_ID with your locker ID (alphanumerical string). You will need two functions that will be passed to the get() method. The first one is used to display the offers returned by the API and the second one for when the user completes an offer. You do not need to make any checks for offer completion since the SDK does it automatically once it is initialized.
var MyLocker = new CPABlend();
MyLocker.init('API_KEY', 'LOCKER_ID');
Get the offers
MyLocker.get(my_locker_locked, my_locker_unlocked);
If the user has not completed an offer, the first function will be called to display the offers to the user. You can customize the output any way you want. In the meantime automated checks are made to see if the user has completed an offer. Once a positive response is returned, the second function is called to display the download button and enable the user to download the locked content.

Download sample code
Demo of the advanced example