CallFire Solutions

03. Label Broadcast

Follow

This endpoint allows for adding a label to a broadcast. If label name doesn’t currently exist on system it will be created and saved. Labels can be added to both running and non-running broadcasts alike. There is no requirement for one to be running.

Note: There is, currently, no way of seeing, directly, which labels are attached to which broadcasts.

Endpoint

https://www.callfire.com/api/1.1/rest/label/broadcast/{id}

Request Type

POST

Request Headers

Content-Type application/xml
Accepts application/xml

Returns

On success, requests to this endpoint do not return an XML response payload, but do return an HTTP 204 No Content status code..

Request Arguments

ArgumentTypeDescription
Id long required - Default: 1000. The maximum number of results to return.
LabelName string required. The encoded name of the label to add to the broadcast.

Curl

curl -i https://www.callfire.com/api/1.1/rest/label/broadcast/5351628003/?LabelName=Here-Is-My-Label \
  -H "Accept: application/xml" \
  -X POST \
  --user <YOUR_LOGIN>:<YOUR_PASSWORD>

PHP SDK

<<?php

$requestRegionQuery = new Request\QueryRegions();
$requestRegionQuery->setTimeZone('Europe\Berlin')
    ->setMaxResults(5);
$response = $app->callfireNumberRestClient->QueryRegions($requestRegionQuery);
$result = $callfireNumberRestClient::response($response);

$broadcastId = '5351697003';
$query = new Request\LabelBroadcast();
$query->setLabelName('Here Is My Label')
      ->setId($broadcastId);
/** @var \CallFire\Api\Rest\Client\Label $label */
$response = $app->callfireNumberRestClient->LabelBroadcast($broadcastId, $query);
/** @var \CallFire\Common\Resource\Label[] $result */
$result = $callfireNumberRestClient::response($response);

if ($result instanceof \CallFire\Api\Rest\Response\ResourceException) {
    $succeeded = false;
} else {
    $succeeded = true;
}

Node.js

var querystring = require('querystring');
var https = require('https');

var host = 'www.callfire.com';
var path = '/api/1.1/rest/label/broadcast/5351628003';
var login = 'YOUR_LOGIN';
var secret = 'YOUR_SECRET';
var data  = {
    'LabelName': 'Here Is My Label'
};
var endpoint = '?' + querystring.stringify(data);
var options = {
    host: host,
    path: path,
    auth: login + ':' + secret,
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': data.length
    }
};

var req = https.get(options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function(d) {
        process.stdout.write(d);
    });
}).on('error', function(e) {
    console.error(e);
});

// post the data
req.write(data);

req.end();

Go

requestOptions := callfire.CallFireRequestOptions{
    Url:            "https://www.callfire.com/api/1.1/rest/label/broadcast/5351628003/?",
    Login:          "YOUR_LOGIN",
    Secret:         "YOUR_PASSWORD",
    ReqType:        "POST",
    RequestOptions: "LabelName=Here+Is+My+Label",
}
client, req := callfire.InitHttpClient(requestOptions)
resp, err := client.Do(req)

Example Response

If the request is successful, no XML response payload will be returned, but an HTTP 204 No Content status code will be.

Malformed Request

If either the request is malformed the response below will be returned

HTTP/1.1 500
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<r:ResourceException xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">
    <r:HttpStatus>500</r:HttpStatus>
    <r:Message>Internal Server Error</r:Message>
</r:ResourceException>

Have more questions? Submit a request

Comments