CallFire Solutions

03. Get Information About A Single Number Owned By Your Account

Follow

This endpoint returns information for a single number assigned to an account.

Endpoint

https://www.callfire.com/api/1.1/rest/number/:number

Request Type

GET

Request Headers

Content-Type application/xml
Accepts application/xml

Returns

If successful, requests to this endpoint return an XML payload containing the details about the number searched for, including such details as region, status, lease information, and number configuration.

Request Arguments

ArgumentTypeDescription
Number string 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: +1 (405) 509 2773.

Example Request

Curl

curl -i https://www.callfire.com/api/1.1/rest/number/12092084590 \
  -H "Accept: application/xml" \
  --user <YOUR_LOGIN>:<YOUR_PASSWORD>

PHP SDK

<?php

// Call the GetNumber method, passing the phone number to query
$response = $callfireNumberClient->GetNumber("+".$number);

// Marshall the response into a \CallFire\Api\Rest\Response\Resource object
// which contains a list of \CallFire\Common\Resource\Number objects
$result = $callfireNumberClient::response($response);

// Iterate over the Resource object, displaying the properties. 
// Here's a quick sample
foreach ($result as $number) {
    printf(
        "Inbound Call Type: %s<br />
         Calls Enabled: %s<br />
         Messages Enabled: %s",
        // 'IVR' or 'Tracking'
        $number->getNumberConfiguration()->getInboundCallConfigurationType(), 
        // Is calling enabled?
        $number->getNumberConfiguration()->getCallFeature(),
        // Is messaging enabled?
        $number->getNumberConfiguration()->getTextFeature()
    );
}

Node.js

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

var req = https.get({
    host: 'www.callfire.com',
    path: '/api/1.1/rest/number/12092084590',
    auth: 'YOUR_LOGIN' + ':' + 'YOUR_PASSWORD'
}, function (res) {
    res.on('data', function (d) {
        process.stdout.write(d);
    });
}).on('error', function (e) {
    console.error(e);
});

req.end();

Go

requestOptions := callfire.CallFireRequestOptions{
    Url:            "https://www.callfire.com/api/1.1/rest/number/12092084590",
    Login:          "YOUR_LOGIN",
    Secret:         "YOUR_PASSWORD",
    ReqType:        "GET",
}
client, req := callfire.InitHttpClient(requestOptions)
resp, err := client.Do(req)

Example Response

On Success

Similar to the list numbers endpoint, the Get Number endpoint returns an XML payload containing a single Number element, which contains all of the data as the list numbers response payload.

HTTP/1.1 200 OK
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<r:ResourceList xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource" totalResults="2"> 
    <Number> 
        <Number>12092084590</Number> 
        <NationalFormat>(209) 208-4590</NationalFormat> 
        <TollFree>false</TollFree> 
        <Region>
            <Prefix>1209208</Prefix> 
            <City>WATERFORD</City> 
            <State>CA</State>
            <Zipcode>95386</Zipcode> 
            <Country>US</Country> 
            <Lata>738</Lata>
            <RateCenter>KNIGHTFRRY</RateCenter> 
            <Latitude>37.8248</Latitude>
            <Longitude>-120.665</Longitude> 
            <TimeZone>America/Los_Angeles</TimeZone>
        </Region> 
        <Status>ACTIVE</Status> 
        <LeaseInfo>
            <LeaseBegin>2015-01-22Z</LeaseBegin> 
            <LeaseEnd>2015-02-21Z</LeaseEnd>
            <AutoRenew>true</AutoRenew> 
        </LeaseInfo> 
        <NumberConfiguration>
            <CallFeature>DISABLED</CallFeature> 
            <TextFeature>ENABLED</TextFeature>
        </NumberConfiguration> 
    </Number> 
</r:ResourceList> 

Failure - Number Not Associated With Your Account

If a number is not associated with the account credentials provided, the following XML payload will be returned, with an HTTP 404 status code.

<?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>number 12092084591 does not exist, or is inactive</r:Message>
</r:ResourceException>

 

Have more questions? Submit a request

Comments