Warning: Undefined array key "EXTRAS" in /home2/asmedia/public_html/app/sys/core/init.php on line 122

Warning: Undefined array key "__thinkcms" in /home2/asmedia/public_html/app/sys/modules_cached.php on line 949

Warning: Undefined array key "EXTRAS" in /home2/asmedia/public_html/app/sys/core/init.php on line 122

Warning: Undefined array key "EXTRAS" in /home2/asmedia/public_html/app/sys/core/init.php on line 122

Warning: Undefined array key "EXTRAS" in /home2/asmedia/public_html/app/sys/modules/app.users/Session.class.php on line 37

Warning: Undefined array key "login" in /home2/asmedia/public_html/app/sys/modules_cached.php on line 966

Warning: Undefined array key "a" in /home2/asmedia/public_html/app/sys/modules_cached.php on line 967

Warning: Undefined array key "EXTRAS" in /home2/asmedia/public_html/app/sys/core/init.php on line 122

Warning: Undefined array key "path" in /home2/asmedia/public_html/_inc/functions.php on line 46

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home2/asmedia/public_html/_inc/functions.php on line 46

Warning: Trying to access array offset on value of type bool in /home2/asmedia/public_html/docs/api/index.php on line 7
Developer API Documentation - AS Media Solutions /home2/asmedia/public_html/_inc/meta.php on line 10
" >
Warning: Undefined array key "META_EXTENSION" in /home2/asmedia/public_html/_inc/meta.php on line 41

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:

https://api.asmediasolutions.com/cpablend.api.js

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