Home Sign In Try Free

Groups


The groups object contains functions related to adding, removing and retreiving groups

get_all()

Returns an array containing all groups. Returns an empty array if no groups exist.

Function Declaration

public function get_all();

Example Code

$textplode = new Textplode('API_KEY');
$groups = $textplode->groups->get_all();

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":[{"id":"1","name":"Group One","count":"5"},{"id":"2","name":"Group Two","count":"10"}]}

get()

Returns a single group by it's ID. Returns an empty array if group does not exist.

Function Declaration

public function get($id);

Example Code

$textplode = new Textplode('API_KEY');
$group = $textplode->groups->get(1);

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":[{"id":"1","name":"Group One","count":"5"}]}

add()

Add a group. Returns the number of affected rows.

Function Declaration

public function add($name);

Example Code

$textplode = new Textplode('API_KEY');
$textplode->groups->add('Group Three');

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":{"rows":1}}

remove()

Remove a group. Returns the number of affected rows.

Function Declaration

public function remove($id);

Example Code

$textplode = new Textplode('API_KEY');
$group = $this->groups->get(1);
$id = $group['group_id'];
$textplode->groups->remove($id);

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":{"rows":1}}