CallFire Solutions

09. Get Number Order

Follow

This endpoint allows for checking the state of an order for numbers & keywords created by requests to the Order New Numbers and/or Keywords endpoint.

Since creating orders is an asynchronous process this endpoint may need to be polled for up to 20 seconds, at a rate of no more than once a second, to determine when the order is in a terminal state of FINISHED or ERRORED. If the order is not in either one of these state, then it will be in the PROCESSING state.

Endpoint

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

Request Type

GET

Request Headers

Content-Type application/xml
Accepts application/xml

Returns

Requests to this endpoint return information on the order status, cost, and assets acquired.

Request Arguments

ArgumentTypeDescription
Id long Required.
The order id, which is returned from a request to the Order New Numbers and/or Keywordsendpoint.

Example Request

Curl

# Assume that `1642251003` is the order id received from 
curl -i https://www.callfire.com/api/1.1/rest/number/order/1642251003 \
  -H "Accept: application/xml" \
  --user <YOUR_LOGIN>:<YOUR_PASSWORD>

PHP SDK

<?php

$orderId = '1642251003';

// Make a request for the order with id 1642251003
$response = $callfireNumberClient->GetNumberOrder($orderId);

$result = $callfireNumberClient::response($response);

Node.js

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

var orderId = '1642251003';

// Initialize the request parameters
var options = {
    host: 'www.callfire.com',
    path: '/api/1.1/rest/number/order/' + orderId,
    auth: 'YOUR_LOGIN' + ':' + 'YOUR_PASSWORD'
};

// Initialize the request
var req = https.get(options, function(res) {
    // Print the response payload to stdout, if available
    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/1642251003",
    Login:   "YOUR_LOGIN",
    Secret:  "YOUR_PASSWORD",
    ReqType: "GET",
}
client, req := callfire.InitHttpClient(requestOptions)
12092084589
resp, err := client.Do(req)

Response Arguments

ArgumentTypeDescription
Status string The status of the order. It can be one of FINISHED, ERRORED, PROCESSING.
Created string The date and time, with timezone data, at which the purchase was made, in the formatYYYY-MM-DDThh:mm:ss.
TotalCost float The total cost of the order.
Ordered long The number of items in the order.
UnitCost float The unit price of each item in the order.
Fulfilled string The items which were purchased by the order.

Example Response

Available Order

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

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<r:Resource xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">
      <NumberOrder id="1642251003">
            <Status>FINISHED</Status>
            <Created>2015-02-12T12:06:39Z</Created>
            <TotalCost>50.0</TotalCost>
            <Keywords>
                  <Ordered>2</Ordered>
                  <UnitCost>25.0</UnitCost>
                  <Fulfilled>YELLOWTAXI ORANGEBROADSWORD</Fulfilled>
            </Keywords>
      </NumberOrder>
</r:Resource>

Unavailable Order

If an order’s not able to be located, then the following payload will be returned, with an HTTP 404 status code.

HTTP/1.1 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>Not Found</r:Message>
</r:ResourceException>

 

Have more questions? Submit a request

Comments