Method: GET
Endpoint: /api/getBroadcasts
Parameter
Parameter |
Type |
Required |
Description |
id |
int |
No |
id of the broadcast to fetch details |
user_id |
int |
No |
Get broadcasts of a particular user |
group_id |
int |
No |
Group id of the broadcasts you want to get |
limit_start |
int (default: 0) |
No |
Starting row of result. Default: 0 |
limit_count |
int (default: 25) |
No |
Number of records to get. Default: 25 |
Response Parameters
Parameter |
Type |
Description |
status |
JSON |
Success or Error |
result |
JSON |
Result of the operation |
Example Request (CURL)
<?php
// Authentication
$api_token = 'API_KEY'; // Mumara API Key (can be found in Settings -> API Key)
$domain = 'http://www.anydomain.com'; // Your Mumara Domain Name
// API Endpoint
$endpoint = '/api/getBroadcasts';
//parameters
$data = array (
//'group_id' => '2',
'user_id' => '2',
'limit_start' => '1',
'limit_count' => '2',
);
$params = '';
foreach($data as $key=>$value)
$params .= $key.'='.$value.'&';
$params = trim($params, '&');
// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint.'?'.$params);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Executing cURL
$output = curl_exec ($ch);
// Printing Output
echo "<pre>";
echo json_encode(json_decode($output),JSON_PRETTY_PRINT );
// Closing cURL
curl_close ($ch);
?>
Example Response (JSON)
{
"status": "success",
"result": [
{
"id": 2,
"name": "broadcast via api",
"subject": "Test subject",
"group_id": 8,
"content_html": "<p>test<\/p>",
"content_text": "test",
"user_id": 2,
"created_at": "2019-05-14 10:45:06",
"updated_at": "2019-05-14 10:45:06"
},
{
"id": 3,
"name": "broadcast via api",
"subject": "Test subject",
"group_id": 8,
"content_html": "<p>test<\/p>",
"content_text": "test",
"user_id": 2,
"created_at": "2019-05-14 10:46:06",
"updated_at": "2019-05-14 10:46:06"
}
]
}
Status value of the success response will be "Success"
Example Error Response (JSON)
{
"status": "error",
"result": "Error: Broadcast doesn't exist."
}
Possible Errors
- Invalid broadcast id
- Invalid user id
- Invalid group id
- Access Denied