Deprecated
JSON-RPC API is deprecated.
Returns information about a logged in user's access to offer, based on the used device.
Entitlement checks are used as a base for reporting. You can see the recommended approach to using the entitlement methods here.
Parameters
Name | Type | Description |
---|---|---|
customerToken* | string | Token that identifies the customer, read more in Must know about API section. |
offerId* | string | Set offerId and check if customer has access to the offer. |
deviceId* | string | In order to prevent using the offer from too many devices, there's a limit of 3 device IDs per user. A single ID is marked by used for 3 hours. That means, that if the user used too many devices and a device ID was blacklisted, after 3 hours it will be available again if some other device ID expires. |
deviceType* | string | Device type, e.g. 'roku' |
API Request/Response
Request
{
"method": "getAccessStatusForDevice",
"params": {
"customerToken": "GeO3HV8Zmf4o4ID6QPBwRDghN9MXGiOLekgmXlKW-yJWpN-j",
"offerId": "S580476507_US",
"deviceId": "your_device_unique_id",
"deviceType": "name_of_device_you_integrate_with"
},
"jsonrpc": "2.0",
"id": 1
}
Response
{
"result": {
"accessGranted": true,
"grantType": "direct-purchase",
"expiresAt": null,
"socialCommissionUrl": null
},
"id": "1",
"error": null,
"jsonrpc": "2.0"
}
PHP Example
<?php
$offerId = 'S580476507_PL';
$cleengApi = new Cleeng_Api();
$offerAccess = $cleengApi->getAccessStatusForDevice($offerId, 'device_unique_id', 'roku');
if($offerAccess->accessGranted) {
//user has access to the content. Put your content here,
} else {
//user has no access, show 'Buy' button. Read more in Tutorial 1 - Protect you content
}
?>