Home / Selections / addSubscribers

Selections ‐ addSubscribers


Description:

Add subscribers to a selections

The following errors can occur:
- Token not present in request.
- Token not in the required format.
- Session does not exist.
- Session has expired.
- The user does not exist.
- No database specified.
- Database parameter not in correct format.
- You are not allowed to access this database.
- The email parameter is required.
- The email parameter is invalid.
- The selected subscriber does not exist.
- An id/list of ids are required.
- The subscriber parameter is required.
- The selection parameter is required.
- The selection parameter is not an unsigned integer.
- The selection does not exists.
- Can't add subscribers to a Dynamic selection.
- The subscriber with the subscriber id %s is not an unsinged integer.
- Failed to add the subscriber with the id %s to the selection.

Example:

You should call this function as followed:
- rest/v2/selections/addSubscribers?token=TOKEN&database=DATABASE_ID&selection=SELECTION_ID&subscriber[]=SUBSCRIBER_ID&subscriber[]=SUBSCRIBER_ID

                require_once 'Rest.php';

                $username = 'my_username';
                $password = 'my_password';
                $database = '999';

                $rest = new Rest($username, $password, $database);
                $result = $rest->call('selections/addSubscribers', [
                	'selection' => 'SELECTION_ID',
'subscriber' => [
'SUBSCRIBER_ID',
'SUBSCRIBER_ID'
] ], 'GET'); var_dump($result);

Parameters:

The following parameters this method can/should be called with:

key: selection
values: integer, unsigned integer, required
what: The ID of a selection

key: subscriber
values: array[integer] = integer, unsigned integer, required
what: The ID('s) of a subscriber

See:

The following items:
- user/login For the TOKEN.
- user/database For the DATABASE_ID
- selections/findByName For the SELECTION_ID
- subscriber/findByEmail For the SUBSCRIBER_ID