geniusreferrals / geniusreferrals
This client allows you to implement referral programs using the Genius Referrals RESTful API.
Installs: 7 960
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
pkg:composer/geniusreferrals/geniusreferrals
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- apimatic/jsonmapper: ~1.0.0
- mashape/unirest-php: ~3.0.1
This package is not auto-updated.
Last update: 2025-10-16 06:42:43 UTC
README
How to Build
The generated code has dependencies over external libraries like UniRest. These dependencies are defined in the composer.json file that comes with the SDK.
To resolve these dependencies, we use the Composer package manager which requires PHP greater than 5.3.2 installed in your system.
Visit https://getcomposer.org/download/ to download the installer file for Composer and run it in your system.
Open command prompt and type composer --version. This should display the current version of the Composer installed if the installation was successful.
- Using command line, navigate to the directory containing the generated files (including
composer.json) for the SDK. - Run the command
composer install. This should install all the required dependencies and create thevendordirectory in your project directory.
[For Windows Users Only] Configuring CURL Certificate Path in php.ini
CURL used to include a list of accepted CAs, but no longer bundles ANY CA certs. So by default it will reject all SSL certificates as unverifiable. You will have to get your CA's cert and point curl at it. The steps are as follows:
- Download the certificate bundle (.pem file) from https://curl.haxx.se/docs/caextract.html on to your system.
- Add curl.cainfo = "PATH_TO/cacert.pem" to your php.ini file located in your php installation. “PATH_TO” must be an absolute path containing the .pem file.
[curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an ; absolute path. ;curl.cainfo =
How to Intall on your Project via Composer
composer install geniusreferrals/geniusreferrals
How to Use
The following section explains how to use the GeniusReferrals library in a new project.
1. Open Project in an IDE
Open an IDE for PHP like PhpStorm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
Click on Open in PhpStorm to browse to your generated SDK directory and then click OK.
2. Add a new Test Project
Create a new directory by right clicking on the solution name as shown below:
Name the directory as "test"
Add a PHP file to this project
Name it "testSDK"
Depending on your project setup, you might need to include composer's autoloader in your PHP code to enable auto loading of classes.
require_once "../vendor/autoload.php";
It is important that the path inside require_once correctly points to the file autoload.php inside the vendor directory created during dependency installations.
After this you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.
3. Run the Test Project
To run your project you must set the Interpreter for your project. Interpreter is the PHP engine installed on your computer.
Open Settings from File menu.
Select PHP from within Languages & Frameworks
Browse for Interpreters near the Interpreter option and choose your interpreter.
Once the interpreter is selected, click OK
To run your project, right click on your PHP file inside your Test project and click on Run
How to Test
Unit tests in this SDK can be run using PHPUnit.
- First install the dependencies using composer including the
require-devdependencies. - Run
vendor\bin\phpunit --verbosefrom commandline to execute tests. If you have installed PHPUnit globally, run tests usingphpunit --verboseinstead.
You can change the PHPUnit test configuration in the phpunit.xml file.
Initialization
Authentication
In order to setup authentication and initialization of the API client, you need the following information.
| Parameter | Description |
|---|---|
| contentType | The content type |
| xAuthToken | Your API Token, you can get your token here https://www.geniusreferrals.com/en/settings/api-access |
API client can be initialized as following.
// Configuration parameters and credentials $contentType = "application/json"; // The content type $xAuthToken = "3b9d11374b602fb47b987dff90f1c5940a1f377f"; // Your API Token, you can get your token here https://www.geniusreferrals.com/en/settings/api-access $client = new GeniusReferralsLib\GeniusReferralsClient($contentType, $xAuthToken);
Class Reference
List of Controllers
- RootsController
- AuthenticationsController
- AdvocatesController
- AccountsController
- ReportsController
- ReferralsController
- RedemptionRequestsController
- BonusesController
- CampaignsController
RootsController
Get singleton instance
The singleton instance of the RootsController class can be accessed from the API Client.
$roots = $client->getRoots();
getRoot
The root of the API
function getRoot()
Example Usage
$result = $roots->getRoot();
AuthenticationsController
Get singleton instance
The singleton instance of the AuthenticationsController class can be accessed from the API Client.
$authentications = $client->getAuthentications();
getAuthentication
Allow clients to test authentication on Genius Referrals platform.
function getAuthentication()
Example Usage
$result = $authentications->getAuthentication();
AdvocatesController
Get singleton instance
The singleton instance of the AdvocatesController class can be accessed from the API Client.
$advocates = $client->getAdvocates();
deleteAdvocate
Delete an advocate
function deleteAdvocate( $accountSlug, $advocateToken)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $advocates->deleteAdvocate($accountSlug, $advocateToken);
putAdvocate
Update an advocate.
function putAdvocate( $accountSlug, $advocateToken, $advocateForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| advocateForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $advocateForm = new AdvocateForm(); $advocates->putAdvocate($accountSlug, $advocateToken, $advocateForm);
postAdvocate
Create a new advocate.
function postAdvocate( $accountSlug, $advocateForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $advocateForm = new AdvocateForm(); $result = $advocates->postAdvocate($accountSlug, $advocateForm);
getAdvocate
Get an advocate by a given token.
function getAdvocate( $accountSlug, $advocateToken)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $result = $advocates->getAdvocate($accountSlug, $advocateToken);
deleteAdvocates
Delete all advocates
function deleteAdvocates($accountSlug)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
Example Usage
$accountSlug = 'account_slug'; $advocates->deleteAdvocates($accountSlug);
getAdvocates
Get the list of advocates
function getAdvocates( $accountSlug, $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: name, lastname, email, advocate_token, bonus_exchange_method_slug, campaign_slug, can_refer, is_referral, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
Example Usage
$accountSlug = 'account_slug'; $page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $advocates->getAdvocates($accountSlug, $page, $limit, $filter, $sort);
patchAdvocate
Update partial elements of an advocate.
function patchAdvocate( $accountSlug, $advocateToken, $advocatePatchForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| advocatePatchForm | Required Collection |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $advocatePatchForm = new AdvocatePatchForm(); $result = $advocates->patchAdvocate($accountSlug, $advocateToken, $advocatePatchForm);
getShareLinks
Get the advocates share links. These are the links that advocates use to share your services online. Share links are wrapped per campaign and widget package.
function getShareLinks( $accountSlug, $advocateToken)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $result = $advocates->getShareLinks($accountSlug, $advocateToken);
putPaymentMethod
Update a payment method.
function putPaymentMethod( $accountSlug, $advocateToken, $advocatePaymentMethodId, $advocatePaymentMethodForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The advocate's token |
| advocateToken | Required |
The advocate's token |
| advocatePaymentMethodId | Required |
The payment method's identifier |
| advocatePaymentMethodForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $advocatePaymentMethodId = 147; $advocatePaymentMethodForm = new PaymentMethodForm(); $advocates->putPaymentMethod($accountSlug, $advocateToken, $advocatePaymentMethodId, $advocatePaymentMethodForm);
getPaymentMethod
Get an advocate's payment method
function getPaymentMethod( $accountSlug, $advocateToken, $advocatePaymentMethodId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| advocatePaymentMethodId | Required |
The payment method's identifier |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $advocatePaymentMethodId = 147; $result = $advocates->getPaymentMethod($accountSlug, $advocateToken, $advocatePaymentMethodId);
postPaymentMethod
Create a new payment method.
function postPaymentMethod( $accountSlug, $advocateToken, $advocatePaymentMethodForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| advocatePaymentMethodForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $advocatePaymentMethodForm = new PaymentMethodForm(); $result = $advocates->postPaymentMethod($accountSlug, $advocateToken, $advocatePaymentMethodForm);
getBonusRedemptionMethod
Get bonuses redemption method.
function getBonusRedemptionMethod($bonusesRedemptionMethodSlug)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| bonusesRedemptionMethodSlug | Required |
The bonus redemption method's identifier |
Example Usage
$bonusesRedemptionMethodSlug = 'bonuses_redemption_method_slug'; $result = $advocates->getBonusRedemptionMethod($bonusesRedemptionMethodSlug);
getBonusRedemptionMethods
Get bonuses redemption methods.
function getBonusRedemptionMethods()
Example Usage
$result = $advocates->getBonusRedemptionMethods();
getCurrencies
Get currencies.
function getCurrencies()
Example Usage
$result = $advocates->getCurrencies();
getCurrency
Get a currency.
function getCurrency($code)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| code | Required |
The currency's code |
Example Usage
$code = 'code'; $result = $advocates->getCurrency($code);
getPaymentMethods
Get the advocate's payment methods.
function getPaymentMethods( $accountSlug, $advocateToken, $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: username, is_active. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: username, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort=last_name|first_name|-hire_date |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $advocates->getPaymentMethods($accountSlug, $advocateToken, $page, $limit, $filter, $sort);
AccountsController
Get singleton instance
The singleton instance of the AccountsController class can be accessed from the API Client.
$accounts = $client->getAccounts();
getAccount
Get an account by a given slug.
function getAccount($accountSlug)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
Example Usage
$accountSlug = 'account_slug'; $result = $accounts->getAccount($accountSlug);
getAccounts
Get the list of accounts.
function getAccounts( $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: name. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: name, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort=last_name|first_name|-hire_date |
Example Usage
$page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $accounts->getAccounts($page, $limit, $filter, $sort);
ReportsController
Get singleton instance
The singleton instance of the ReportsController class can be accessed from the API Client.
$reports = $client->getReports();
getReferralsSummaryPerOrigin
Get referrals summary per referral origin.
function getReferralsSummaryPerOrigin($advocateToken)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| advocateToken | Required |
The advocate's token |
Example Usage
$advocateToken = 'advocate_token'; $result = $reports->getReferralsSummaryPerOrigin($advocateToken);
getBonusesSummaryPerOrigin
Get bonuses summary per referral origin.
function getBonusesSummaryPerOrigin($advocateToken)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| advocateToken | Required |
The advocate's token |
Example Usage
$advocateToken = 'advocate_token'; $result = $reports->getBonusesSummaryPerOrigin($advocateToken);
getTopAdvocates
Get top 10 advocates.
function getTopAdvocates( $accountSlug = null, $campaignSlug = null, $limit = 10, $from = null, $to = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Optional |
The account identifier |
| campaignSlug | Optional |
The campaign identifier |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10) |
| from | Optional |
The datetime were the range of the search starts |
| to | Optional |
The datetime were the range of the search stops |
Example Usage
$accountSlug = 'account_slug'; $campaignSlug = 'campaign_slug'; $limit = 10; $from = date("D M d, Y G:i"); $to = date("D M d, Y G:i"); $result = $reports->getTopAdvocates($accountSlug, $campaignSlug, $limit, $from, $to);
getShareDailyParticipation
Get share daily participation.
function getShareDailyParticipation( $accountSlug = null, $campaignSlug = null, $advocateToken = null, $from = null, $to = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Optional |
The account identifier |
| campaignSlug | Optional |
The campaign identifier |
| advocateToken | Optional |
The advocate's token |
| from | Optional |
The datetime were the range of the search starts |
| to | Optional |
The datetime were the range of the search stops |
Example Usage
$accountSlug = 'account_slug'; $campaignSlug = 'campaign_slug'; $advocateToken = 'advocate_token'; $from = date("D M d, Y G:i"); $to = date("D M d, Y G:i"); $result = $reports->getShareDailyParticipation($accountSlug, $campaignSlug, $advocateToken, $from, $to);
getReferralDailyParticipation
Get referral daily participation.
function getReferralDailyParticipation( $accountSlug = null, $campaignSlug = null, $advocateToken = null, $from = null, $to = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Optional |
The account identifier |
| campaignSlug | Optional |
The campaign identifier |
| advocateToken | Optional |
The advocate's token |
| from | Optional |
The datetime were the range of the search starts |
| to | Optional |
The datetime were the range of the search stops |
Example Usage
$accountSlug = 'account_slug'; $campaignSlug = 'campaign_slug'; $advocateToken = 'advocate_token'; $from = date("D M d, Y G:i"); $to = date("D M d, Y G:i"); $result = $reports->getReferralDailyParticipation($accountSlug, $campaignSlug, $advocateToken, $from, $to);
getClickDailyParticipation
Get click daily participation.
function getClickDailyParticipation( $accountSlug = null, $campaignSlug = null, $advocateToken = null, $from = null, $to = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Optional |
The account identifier |
| campaignSlug | Optional |
The campaign identifier |
| advocateToken | Optional |
The advocate's token |
| from | Optional |
The datetime were the range of the search starts |
| to | Optional |
The datetime were the range of the search stops |
Example Usage
$accountSlug = 'account_slug'; $campaignSlug = 'campaign_slug'; $advocateToken = 'advocate_token'; $from = date("D M d, Y G:i"); $to = date("D M d, Y G:i"); $result = $reports->getClickDailyParticipation($accountSlug, $campaignSlug, $advocateToken, $from, $to);
getBonusesDailyGiven
Get bonuses daily given.
function getBonusesDailyGiven( $accountSlug = null, $campaignSlug = null, $advocateToken = null, $from = null, $to = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Optional |
The account identifier |
| campaignSlug | Optional |
The campaign identifier |
| advocateToken | Optional |
The advocate identifier |
| from | Optional |
The datetime were the range of the search starts |
| to | Optional |
The datetime were the range of the search stops |
Example Usage
$accountSlug = 'account_slug'; $campaignSlug = 'campaign_slug'; $advocateToken = 'advocate_token'; $from = date("D M d, Y G:i"); $to = date("D M d, Y G:i"); $result = $reports->getBonusesDailyGiven($accountSlug, $campaignSlug, $advocateToken, $from, $to);
ReferralsController
Get singleton instance
The singleton instance of the ReferralsController class can be accessed from the API Client.
$referrals = $client->getReferrals();
getReferralOrigin
Get a referral origin by a given slug.
function getReferralOrigin($referralOriginSlug)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| referralOriginSlug | Required |
The referral origin identifier |
Example Usage
$referralOriginSlug = 'referral_origin_slug'; $result = $referrals->getReferralOrigin($referralOriginSlug);
getReferralOrigins
Get referral origins. This is needed when creating (POST) a new referral, as referral_origin_slug refers to one of this origins.
function getReferralOrigins()
Example Usage
$result = $referrals->getReferralOrigins();
getReferral
Get a referral by a given id.
function getReferral( $accountSlug, $advocateToken, $referralId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| referralId | Required |
The referral id |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $referralId = 'referral_id'; $result = $referrals->getReferral($accountSlug, $advocateToken, $referralId);
deleteReferral
Delete a referral.
function deleteReferral( $accountSlug, $advocateToken, $referralId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| referralId | Required |
The referral identifier |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $referralId = 'referral_id'; $referrals->deleteReferral($accountSlug, $advocateToken, $referralId);
postReferral
Create a new referral.
function postReferral( $accountSlug, $advocateToken, $referralForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| referralForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $referralForm = new ReferralForm(); $result = $referrals->postReferral($accountSlug, $advocateToken, $referralForm);
putReferral
Update a referral.
function putReferral( $accountSlug, $advocateToken, $referralId, $referralForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| referralId | Required |
The referral id |
| referralForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $referralId = 'referral_id'; $referralForm = new ReferralForm(); $referrals->putReferral($accountSlug, $advocateToken, $referralId, $referralForm);
getReferrals
Get the list of referrals for a given advocate.
function getReferrals( $accountSlug, $advocateToken, $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The advocate's token |
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: url, referral_origin_slug, created. Use the following delimiters to build your filters params. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $referrals->getReferrals($accountSlug, $advocateToken, $page, $limit, $filter, $sort);
RedemptionRequestsController
Get singleton instance
The singleton instance of the RedemptionRequestsController class can be accessed from the API Client.
$redemptionRequests = $client->getRedemptionRequests();
getRedemptionRequestStatus
Get a redemption request status.
function getRedemptionRequestStatus($redemptionRequestStatusSlug)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| redemptionRequestStatusSlug | Required |
The redemption request status identifier |
Example Usage
$redemptionRequestStatusSlug = 'redemption_request_status_slug'; $result = $redemptionRequests->getRedemptionRequestStatus($redemptionRequestStatusSlug);
getRedemptionRequestStatuses
Get redemption request statuses.
function getRedemptionRequestStatuses()
Example Usage
$result = $redemptionRequests->getRedemptionRequestStatuses();
getRedemptionRequestAction
Get a redemption request action.
function getRedemptionRequestAction($redemptionRequestActionSlug)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| redemptionRequestActionSlug | Required |
The redemption request action identifier |
Example Usage
$redemptionRequestActionSlug = 'redemption_request_action_slug'; $result = $redemptionRequests->getRedemptionRequestAction($redemptionRequestActionSlug);
getRedemptionRequestActions
Get redemption request actions.
function getRedemptionRequestActions()
Example Usage
$result = $redemptionRequests->getRedemptionRequestActions();
patchRedemptionRequest
Redeem a redemption request. After the redemption request is created it needs to be redeemed. This will deduct the amount of the advocate unclaimed balance and move the request to the completed state.
function patchRedemptionRequest( $accountSlug, $redemptionRequestId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| redemptionRequestId | Required |
The redemption request id |
Example Usage
$accountSlug = 'account_slug'; $redemptionRequestId = 147; $redemptionRequests->patchRedemptionRequest($accountSlug, $redemptionRequestId);
postRedemptionRequest
Create a redemption request.
function postRedemptionRequest( $accountSlug, $redemptionRequestForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| redemptionRequestForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $redemptionRequestForm = new RedemptionRequestForm(); $result = $redemptionRequests->postRedemptionRequest($accountSlug, $redemptionRequestForm);
getRedemptionRequest
Get a redemption request by a given id.
function getRedemptionRequest( $accountSlug, $redemptionRequestId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| redemptionRequestId | Required |
The redemption request identifier |
Example Usage
$accountSlug = 'account_slug'; $redemptionRequestId = 'redemption_request_id'; $result = $redemptionRequests->getRedemptionRequest($accountSlug, $redemptionRequestId);
getRedemptionRequests
Get the list of redemption requests.
function getRedemptionRequests( $accountSlug, $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: redemption_request_id, name, lastname, email, request_status_slug, request_action_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
Example Usage
$accountSlug = 'account_slug'; $page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $redemptionRequests->getRedemptionRequests($accountSlug, $page, $limit, $filter, $sort);
BonusesController
Get singleton instance
The singleton instance of the BonusesController class can be accessed from the API Client.
$bonuses = $client->getBonuses();
getBonuses
Get the list of bonuses for a given account.
function getBonuses( $accountSlug, $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: name, lastname, email, campaign_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
Example Usage
$accountSlug = 'account_slug'; $page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $bonuses->getBonuses($accountSlug, $page, $limit, $filter, $sort);
postBonus
Make an attempt to give a bonus for to the advocate's referrer. The system processes the given advocate (referral) and creates a bonus for the advocate's referrer if is needed. All restrictions set on the campaigns for this account will be check out before giving the bonus to the advocate's referrer.
function postBonus( $accountSlug, $bonusesForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| bonusesForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $bonusesForm = new BonusesForm(); $result = $bonuses->postBonus($accountSlug, $bonusesForm);
getBonusCheckup
Check if there is a bonus to be given to the advocate. Allows the clients to check if there is a bonus to be given, it simulates the behaivor of a POST request to /accounts/{account_slug}/bonuses resource. This resource is idempotent.
function getBonusCheckup( $accountSlug, $advocateToken, $reference, $paymentAmount)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| advocateToken | Required |
The referral's token. Usually the one that completed the purchase, or trigger an event. |
| reference | Required |
The reference number for this request. Usually the order_id, payment_id, or timestamp. |
| paymentAmount | Required |
The payment amount the referrals has made. Required for a percentage based campaign. |
Example Usage
$accountSlug = 'account_slug'; $advocateToken = 'advocate_token'; $reference = 'reference'; $paymentAmount = 105.64688331012; $result = $bonuses->getBonusCheckup($accountSlug, $advocateToken, $reference, $paymentAmount);
postForceBonus
Force the system to give a bonus to an advocate. The system will not take into account the restriccions specified on the campaigns.
function postForceBonus( $accountSlug, $bonusForm)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| bonusForm | Required |
The body of the request |
Example Usage
$accountSlug = 'account_slug'; $bonusForm = new ForceBonusesForm(); $result = $bonuses->postForceBonus($accountSlug, $bonusForm);
getBonusTrace
Get a bonus request trace.
function getBonusTrace( $accountSlug, $traceId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| traceId | Required |
The trace id |
Example Usage
$accountSlug = 'account_slug'; $traceId = 105; $result = $bonuses->getBonusTrace($accountSlug, $traceId);
deleteBonus
Delete a bonus
function deleteBonus( $accountSlug, $bonusId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| bonusId | Required |
The bonus id |
Example Usage
$accountSlug = 'account_slug'; $bonusId = 105; $bonuses->deleteBonus($accountSlug, $bonusId);
getBonus
Get a bonus by a given id.
function getBonus( $accountSlug, $bonusId)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| bonusId | Required |
The bonus id |
Example Usage
$accountSlug = 'account_slug'; $bonusId = 105; $result = $bonuses->getBonus($accountSlug, $bonusId);
getBonusTraces
Get the list of bonuses traces (audit trail). Every time the system tries to give a bonus the an advocate a new trace is created.
function getBonusTraces( $accountSlug, $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: reference, result, bonus_amount, advocate_token, advocate_referrer_token, campaign_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
Example Usage
$accountSlug = 'account_slug'; $page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $bonuses->getBonusTraces($accountSlug, $page, $limit, $filter, $sort);
CampaignsController
Get singleton instance
The singleton instance of the CampaignsController class can be accessed from the API Client.
$campaigns = $client->getCampaigns();
getCampaign
Get a campaign by a given slug.
function getCampaign( $accountSlug, $campaignSlug)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| campaignSlug | Required |
The campaign identifier |
Example Usage
$accountSlug = 'account_slug'; $campaignSlug = 'campaign_slug'; $result = $campaigns->getCampaign($accountSlug, $campaignSlug);
getCampaigns
Get the list of campaings for a given account.
function getCampaigns( $accountSlug, $page = 1, $limit = 10, $filter = null, $sort = null)
Parameters
| Parameter | Tags | Description |
|---|---|---|
| accountSlug | Required |
The account identifier |
| page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
| limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
| filter | Optional |
Allowed fields: name, description, start_date, end_date, is_active (true|false), created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
| sort | Optional |
Allowed fields: campaign_slug, created, start_date, end_date, is_active. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
Example Usage
$accountSlug = 'account_slug'; $page = 1; $limit = 10; $filter = 'filter'; $sort = 'sort'; $result = $campaigns->getCampaigns($accountSlug, $page, $limit, $filter, $sort);