Optimove
PHP Optimove API client., (*1)
Requirements
Implemented API calls:
- general/login
- integrations/AddPromotions
- integrations/GetPromotions
- integrations/DeletePromotions
Example
"WB23", "PromotionName" => "Welcome back Promo"}],
["PromoCode" => "NV10", "PromotionName" => "New VIP 10% Discount"]
];
$client->promotions()->AddPromotions($promotions);
?>
Reference
Client object has methods which returns objects for specific API parts.
Client's available methods:
- general() - returns object for general/* calls
- promotions() - returns object for promotions/* calls, (*2)
Client
This is main object which contains all methods which you need to use Optimove API., (*3)
__construct(string $username, string $password)
Client constructor require following arguments:
- string $username - Optimove account username
- string $password - Optimove account password, (*4)
Example:
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
general() :General
Method returns General object., (*5)
Example:
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$general = $client->general();
Method returns Promotions object., (*6)
Example:
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$promotions = $client->promotions();
General
To retrieve General object you should call method general() from Client object., (*7)
login(string $username, string $password)
Method login Client to Optimove API. This method is auto executed durning creating Client instance., (*8)
Parameters
- string
$username - Optimove account username
- string
$password - Optimove account password
Example:
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$newUser = 'bar';
$newPassword = 'secret';
$client->general()->login($newUser, $newPassword);
To retrieve Promotions object you need call method promotions() from Client object., (*9)
Adds promo codes and associated names that will be available for selection when running a campaign.
There is no need to worry about Optimove limit to sending promo coded., (*10)
If you will send more than 100 promocodes in one call then method will chunk your data and will send your data using several API calls., (*11)
Parameters
- array
$promotions
Array of promotions, each promotions should be array which has following keys
Example:
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$promotions = [
["PromoCode" => "WB23", "PromotionName" => "Welcome back Promo"}],
["PromoCode" => "NV10", "PromotionName" => "New VIP 10% Discount"]
];
$client->promotions()->AddPromotions($promotions);
Returns an array of all defined promo codes and associated names., (*12)
Parameters
None, (*13)
Example:
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$promotions = $client->promotions()->GetPromotions();
Removes previously-added promo codes.
There is no need to worry about Optimove limit to sending promo coded., (*14)
If you will send more than 100 promocodes in one call then method will chunk your data and will send your data using several API calls., (*15)
Parameters
- array
$promotions
Array of promotions, each promotions should be array which has following keys
Example:
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$promotions = [
["PromoCode" => "WB23"],
["PromoCode" => "NV10"]
];
$client->promotions()->DeletePromotions($promotions);