Class ApiClient
Antavo Loyalty API client class.
- Antavo\RestClient\RestClient
-
Antavo\ApiClient
public
|
|
public
mixed
|
#
autoOptInCustomer( string $customer, array $data = array() )
Automatically opts customer in if consent cookie is present. |
public
mixed
|
|
public
mixed
|
#
optInCustomer( string $customer, array $data = array() )
Posts an opt-in event to the Events API. $client->optInCustomer('8eb1b522', array( // Providing an email address is mandatory. 'email' => 'john.doe@example.com' )); |
public
mixed
|
#
optOutCustomer( string $customer, array $data = array() )
Posts an opt-out event to the Events API. $client->optOutCustomer('8eb1b522', array( 'reason' => 'Not interested' )); |
public
mixed
|
#
postEvent( string $action, string $customer, array $data = array() )
Posts an event to the Antavo Loyalty Events API. $customer = array( 'id' => '8eb1b522', 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'john.doe@example.com' ); $client = new Antavo\ApiClient('API_KEY', 'API_SECRET'); try { $result = $client->postEvent('opt_in', $customer['id'], array( 'first_name' => $customer['first_name'], 'last_name' => $customer['last_name'], 'email' => $customer['email'] )); } catch (Antavo\RestClient\Exceptions\Exception $e) { echo $e->getMessage(); } |
delete(),
get(),
post(),
put()
|