CallFire Solutions

06. Unlabel Number

Follow

This endpoint allows for removing a label from a number.

Note: At the current time, there is no way of directly knowing which, if any, labels are associated with which numbers. However, this information is available via the Admin UI.

Endpoint

https://www.callfire.com/api/1.1/rest//label/number/{Number}

Request Type

DELETE

Request Headers

Content-Type application/xml
Accepts application/xml

Returns

On success the request does not return an XML payload but does return an HTTP 204 No Content status. If, however, the request fails, because the number or label is not linked to the account, then an XML payload will be returned, along with an HTTP 404 Not Found status code.

Request Arguments

ArgumentTypeDescription
Number long required - A E.164 compliant phone number, which follows the following format: [+][country code][subscriber number including area code]. A US example phone number is: 14055092773.
LabelName string The label to remove from the phone number.

Curl

curl -i https://www.callfire.com/api/1.1/rest/label/number/2092084589/ \
  -X DELETE \
  -H "Accept: application/xml" \
  --form "LabelName=six" \
  --user <YOUR_LOGIN>:<YOUR_PASSWORD>

PHP SDK

<?php
number = '2092084589';
query = new Request\UnlabelNumber();
query->setLabelName('Generic Label')
      ->setNumber(number);
response = app->callfireNumberRestClient->UnlabelNumber(number, query);
result = callfireNumberRestClient::response(response);

Node.js

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

var data  = querystring.stringify({
    LabelName: "Here is a Test Label"
});
var options = {
    host: 'www.callfire.com',
    path: '/api/1.1/rest/label/number/2092084589/',
    auth: 'YOUR_LOGIN' + ':' + 'YOUR_PASSWORD',
    method: 'DELETE',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': data.length
    }
};

var req = https.request(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/2092084589/?",
    Login:   "YOUR_LOGIN",
    Secret:  "YOUR_PASSWORD",
    ReqType: "DELETE",
    RequestOptions: "LabelName=Test%20Label"
}
client, req := callfire.InitHttpClient(requestOptions)
resp, err := client.Do(req)

Example Response

If either the label or phone number specified was not found, then the following XML response will be returned.

HTTP/1.0 404 Not Found
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>404</r:HttpStatus>
      <r:Message>label not found</r:Message>
</r:ResourceException>

If something goes wrong, then the following XML payload will be returned:

HTTP 500 Internal Server Error
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 resource exception. Ref: 50ea105f-ee83-459b-8313-f52f89b942ea</r:Message>
</r:ResourceException>

Have more questions? Submit a request

Comments