subscriber or unsubscribe to different db's at the same time
Hash
if hashed, then first encrypt the email with the public key, after that run it through base64 encode. This will be the value
which you need to be entering in the email parameter
The following messages can occur:
- Subscriber has been unsubscribed (subscribed: 0)
- Subscriber already has been unsubscribed (subscribed: 0)
- Subscriber already subscribed (subscribed: 1)
- Subscriber has been subscribed (subscribed: 1)
The following errors can occur:
- The email parameter is required
- The email parameter has the wrong format
- id key is missing in records parameter
- subscribe key is missing in records parameter
- subscribe key in records parameter is not a number
- subscribe key in records parameter is not 1 or 0
- id key in records parameter is not a number
- No access to some of the given database_ids
- records parameter does not exists or is empty
- records parameter is not a Multidimensional array.
- Subscriber cannot be resubscribed. (subscribed: -1)
- Subscriber does not exists. (subscribed: -2)
- Subscribing for %s has failed. (subscribed: -3)
- Unsubscribing for %s has failed. (subscribed: -4)
You should call this function as followed:
- rest/v2/subscriber/subscriptionStore?token=TOKEN&database=DATABASE_ID&email=EMAIL&records[0][id]=687&records[0][subscribe]=1
require_once 'Rest.php';
$username = 'my_username';
$password = 'my_password';
$database = '999';
$rest = new Rest($username, $password, $database);
$result = $rest->call('subscriber/subscriptionStore', [
'email' => 'EMAIL'
], 'GET');
var_dump($result);
The following parameters this method can/should be called with:
key: email
values: String, required
what: The email of a subscriber
key: hash
values: Integer, optional
what: 0 for disable hashing (default), 1 for enable hashing
key: records
values: Array, required
what: An array with 2 keys: id and subscribe.
key: records[id]
values: Integer, required
what: The id of a database
key: records[subscribe]
values: Integer (1 or 0), required
what: Subscribe or unsubscribe a subscriber
The following items:
- user/login For the TOKEN.
- user/database For the DATABASE_ID
- subscriber/findByEmail For the SUBSCRIBER_ID