CallFire Solutions

08. Order New Numbers and/or Keywords

Follow

The endpoint allows for creating an order to purchase a number of phone numbers and keywords to be added to an account. Creating orders is an asynchronous process. So to check on the status of an order, the Get Number Order endpoint can be polled, no more than once a second, until the order state returned is either FINISHEDor ERRORED.

Endpoint

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

Request Type

POST

Request Headers

Content-Type application/xml
Accepts application/xml

Returns

Requests to this endpoint, if successful, return an int, which is the created order’s id. An order can have one of three states; these are:

StateDescription
FINISHED The order successfully completed
ERRORED There was an error in creating the order
PROCESSING The order is still being processed

Request Arguments

ArgumentTypeDescription
Numbers 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.
Keywords string
A comma or space separated list of keywords.
A keyword can range in length from 1 to a maximum of 64 characters and letters and numbers only.
localCount long The total local numbers to acquire, when purchasing more than one.
Prefix string 4-7 digit prefix
City string The full name of a US city, such as Phoenix.
State string A two character state abbreviation code, such as AZ for Arizona.
Zipcode string A 5 digit, US, zip code, such as 85001 which is located in Phoenix, Arizona.
Country string An international 2 digit country code.
Lata string A 3 digit US LATA code
RateCenter string The RateCenter to use. It’s important to choose the right Rate Center, because when numbers are assigned from Rate Centers local to the premises they’ll be used at they will be deemed as local. Otherwise, there’s the risk of creating a long distance number and incurring long distance call charges.
Latitude float Filter the results returned by latitude. For example: 33.5443.
Longitude float Filter the results returned by longitude. For example: -112.049.
TimeZone string The timezone of the city which the RateCenter is in. The values which can be supplied are any that are supported by the java.util.TimeZone TimeZone.getTimeZone method. Essentially this is either an abbreviation such as “PST”, a full name such as “America/Los_Angeles”, or a custom ID such as “GMT-8:00”. Note that the support of abbreviations is for JDK 1.1.x compatibility only and full names should be used.
tollFreeCount long Amount of phone numbers to acquire int

Example Request

Curl

curl -i https://www.callfire.com/api/1.1/rest/number/order \
  -X POST \
  -F "Numbers=12902084590+12902084589;State=AZ;Country=US;City=Phoenix" \
  -H "Accept: application/xml" \
  --user <YOUR_LOGIN>:<YOUR_PASSWORD>

PHP SDK

<?php

// Initialize a \CallFire\Api\Rest\Request\CreateNumberOrder object to purchase two numbers
$numberOrder = new Request\CreateNumberOrder();
$numberOrder->setNumbers(array(
    "+12092084590", "+12092084589"
))
  ->setCountry('US')
  ->setState('AZ')
  ->setCity('Phoenix');

// Make a request to purchase the two phone numbers
$response = $callfireNumberClient->CreateNumberOrder($numberOrder);

// Marshall the response payload
$result = $callfireNumberClient::response($response);

Node.js

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

var data  = {
    Numbers: "12092084590+12092084589",
    Country: 'US',
    State: 'AZ',
    City: 'Phoenix'
};
var endpoint = '?' + querystring.stringify(data);
var options = {
    host: 'www.callfire.com',
    path: '/api/1.1/rest/number/order',
    query: endpoint,
    auth: 'YOUR_LOGIN' + ':' + 'YOUR_PASSWORD',
    method: 'POST'
};

var req = https.request(options, 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/order?",
    Login:          "YOUR_LOGIN",
    Secret:         "YOUR_PASSWORD",
    ReqType:        "POST",
    RequestOptions: "Numbers=12092084590+12092084589&City=Phoenix&State=AZ&Country=US",
}
client, req := callfire.InitHttpClient(requestOptions)
resp, err := client.Do(req)

Example Response

HTTP/1.1 201 CREATED
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<r:ResourceReference xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">
      <r:Id>1642251003</r:Id>
      <r:Location>https://www.callfire.com/api/1.1/rest/number/order/1642251003</r:Location>
</r:ResourceReference>

 

Have more questions? Submit a request

Comments