PHP Optimove API client.
- PHP 7
- Curl
- general/login
- integrations/AddPromotions
- integrations/GetPromotions
- integrations/DeletePromotions
<?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);
?>
Client object has methods which returns objects for specific API parts.
Client's available methods:
general()- returns object forgeneral/*callspromotions()- returns object forpromotions/*calls
This is main object which contains all methods which you need to use Optimove API.
Client constructor require following arguments:
- string
$username- Optimove account username - string
$password- Optimove account password
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
Method returns General object.
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$general = $client->general();
Method returns Promotions object.
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$promotions = $client->promotions();
To retrieve General object you should call method general() from Client object.
Method login Client to Optimove API. This method is auto executed durning creating Client instance.
- string
$username- Optimove account username - string
$password- Optimove account password
<?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.
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.
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.
- array
$promotionsArray of promotions, each promotions should be array which has following keys- PromoCode
- PromotionName
<?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.
None
<?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.
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.
- array
$promotionsArray of promotions, each promotions should be array which has following keys- PromoCode
<?php
use GenesisGlobal\Optimove\Client;
$username = 'foo';
$password = 'password';
$client = new Client($username, $password);
$promotions = [
["PromoCode" => "WB23"],
["PromoCode" => "NV10"]
];
$client->promotions()->DeletePromotions($promotions);