Big Summer


REST SMS Gateway API – group resource

  • Why not share:
  • Social sharing button for Facebook
  • Social sharing button for Linkedin
  • Social sharing button for Twitter
  • Social sharing button for Googleplus
  • Social sharing button for Pinterest


This resource allows you to view and modify a send group.
This blog post has been superseded with our website documentation
This document is referred to by the REST SMS Gateway API – Specification Document.

Resource URI:

Actions relating to send groups.


POST method

Attempts to add a number or numbers to a group.

Example usage:

Post arguments:

parameter usage
id the ID of the group to add to (optional – if you use ‘name’ instead)
name the name of the group to send to – case-sensitive (optional – if you use ‘id’ instead)
numbers a comma-separated list of numbers to add to the group

NOTE: If you specify a group by it’s name, and the name is not unique, the first matched group will be used.

Example POST response:

<response processed_date="2011-04-07T14:57:00+01:00">
<added quantity="1">
<stopped quantity="0"></stopped>
<duplicates quantity="1">
  • quantity – the number of added/stopped/duplicate numbers
  • added – a list of numbers successfully added to the group
  • stopped – a list of numbers that were not added to the group since they are members of a STOP group
  • duplicates – a list of numbers that were not added to the group since they are already members of the group

Read the advanced specification of this response.

Specific error codes:

Code Meaning
0 the group ID or name was not specified or was invalid
1 group ID or name did not correspond to any known group
2 no numbers were supplied for adding to the group
3 a number was not of a valid format


Example XML error response:

<response processed_date="2011-04-07T15:04:19+01:00">
	<error code="1">Group not found</error>

Example PHP code:

* POST request on the 'group' resource (add numbers to group)
$url = '';
// for testing:
$url = '';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$groupName = 'MyGroupName'; // CHANGE THIS!!
$numbersToAdd = '447777000001,447777000002'; // CHANGE THIS!!
$data = array('name'=>$groupName, 'numbers'=>'$numbersToAdd',
'username'=>$username, 'password'=>$password);
$data = http_build_query($data, '', '&');
// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);
curl_setopt($curlHandle, CURLOPT_POST, 1);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);
// deal with the response
if ($responseInfo['http_code']==200)
$xml_obj = simplexml_load_string($responseBody);
// do something with the result
$xml_added = $xml_obj->added;
$atts = $xml_added->attributes();
$added = (integer) $atts->quantity;
echo "$added added";
} else {
// handle the error here

No related posts.