This command can be used to create a group within your Textlocal account.
https://api.textlocal.in/create_group/
<?php // Account details $apiKey = urlencode('Your apiKey'); // Group details $name = 'Your New Group Name'; // Prepare data for POST request $data = array('apikey' => $apiKey, 'name' => $name); // Send the POST request with cURL $ch = curl_init('https://api.textlocal.in/create_group/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php // Account details $apiKey = urlencode('Your apiKey'); // Group details $name = urlencode('Your New Group Name'); // Prepare data for POST request $data = 'apikey=' . $apiKey . '&name=' . $name; // Send the GET request with cURL $ch = curl_init('https://api.textlocal.in/create_group/?' . $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php require('Textlocal.class.php'); $Textlocal = new Textlocal(false, false, 'your apiKey'); $name = 'Staff'; $response = $Textlocal->createGroup($name); print_r($response); ?>
name | Name of the new group. |
---|---|
Login Parameters (Additional Information) | |
apiKey | You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address. |
{ "group":{ "id":123456, "name":"Your New Group Name" }, "status":"success" }
<?xml version="1.0" encoding="UTF-8" ?> <response> <group> <id>123456</id> <name>Your New Group Name</name> </group> <status>success</status> </response>
Error Codes | |
12 | No group name specified. |
---|---|
13 | Group name is too long. |
14 | Group already exists. |