- QuestBlue’s new REST API provides even more powerful tools with highly optimized functionality, for the best fit to the widest possible range of your needs.
- SSL security technology protects your private data in transmission.
- Two levels of authorization provides a highly secure data exchange with your application.
- JSON data exchange format provides an easy to use format to work with.
- Intuitive API interface lets you easily and quickly build your own VoIP services.
- Head over to https://customer.questblue.com/register and complete the registration process
- Once registration is complete login to your customer dashboard https://customer.questblue.com
- Navigate to Services->Programmers API
- Under API access put in the IP of the server you will be making API calls from
To get started, choose the SDK for the language you will be using. PHP or C#
Navigate to the Connect class
In this file find the lines displayed to the right. Update these lines with the relevant info from your portal
You can now test proper setup by making a call to list the available states.(sample code to right)
<?php
//Setup your credentials in the Connect class:
//Located at api_v2->Connect.php lines 18-22
$this->login = 'ACCOUNT_LOGIN'; // Your account username or API username
$this->password = 'ACCOUNT_PASSWORD'; // Your account password or API password
$this->key = 'ACCOUNT_PRIVATE_KEY'; // Your API private key
$this->type = 'json'; // API type, available values: json, xml
$this->my_ip = '256.256.256.256'; // Your server IP address
//Note: The IP here MUST be the IP you added to the customer portal
?>
<?php
//List the available states sample code
//Require the correct class containing the functions we need
require_once("api_v2/Dids.php");
//Create a new instance of the class
$api = new Dids;
//Call the function to list available states
//and save the response in a variable
$response = $api->listStates();
//Print the results to the screen
print($response);
?>
The Account class gives you access to methods that control your account such as getting or setting your account balance. To get started add a new reference to the Account class
<?php
require_once("api_v2/Account.php");
$account = new Account;
?>
private APICredential _apiCredential = new APICredential("username","password","privkey");
private Account _account = new Account(_apiCredential);
getAccountBalance [GET]
If available, get account balance and allowed credit
Request Method and URL: GET https://api2.questblue.com/account/getbalance
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/account/getbalance
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Grab the balance and store it for later use
$balance = $account->getAccountBalance();
//Print the balance to the screen
print($balance);
?>
string result = _account.GetAccountBalance();
Console.WriteBalance(result);
Response:
Success: {"data": {"balance":"99.00", "allowed_credit":"110.00"} } (HTTP Code: 200)
setAutorefill [PUT]
Enable or disable automatic account autorefill
Request Method and URL: PUT https://api2.questblue.com/account/setautorefill
Params to send:Values: (string) on/off
Description: Enable or Disable
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/account/setautorefill -d "{\"autorefill\":\"on\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Turn autorefill on and store the response
$response = $account->setAutorefill("on");
//Check if the response has errors
if(!empty($response)){
//If the response is not empty print errors
print($response);
}
?>
_account.setautorefill(true);
_account.setautorefill(false);
Response:
Success: empty
Error: {"error":"Error Message"}
setBalanceReload [PUT]
Configure minimum account balance and autorefill values
Request Method and URL: PUT https://api2.questblue.com/account/setbalancereload
Params to send:Values: (int) 5, 25, 30, 35, 40, 45, 50, 100
Description: Minimum account balance
Values: (int) 25, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 1000, 15000, 2000, 2500
Description: Autorefill balance ammount
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/account/setbalancereload -d "{\"min_balance\":5,\"reload_amount\":50}"
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Set minimum balance to $5 and reload amount to $50 and store response
$response = $account->setBalanceReload(5,50);
//Check if the response has errors
if(!empty($response)){
//If the response is not empty print errors
print($response);
}
?>
string result = _account.SetBalanceReload("5", "50");
Console.WriteLine(result);
}
Response:
Success: empty
Error: {"error":"Error Message"}
refillBalance [PUT]
Refill account balance
Request Method and URL: PUT https://api2.questblue.com/account/refillbalance
Params to send:Values: (int) Minimum value 10(USD)
Description: Amount to add to balance
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/account/refillbalance -d "{\"amount\":16}"
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Load $16 to account and store response
$response = $account->refillBalance(16);
//Check if the response has errors
if(!empty($response)){
//If the response is not empty print errors
print($response);
}
?>
string result = _account.RefillBalance("10");
Console.WriteLine(result);
Response:
Success: empty
Error: {"error":"Error Message"}
getRates [GET]
List the service rates
Request Method and URL: GET https://api2.questblue.com/account/rates
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/account/rates
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Get rates and store the response
$rates = $account->getRates();
//Display the rates on the page
print($rates);
?>
string result = _account.GetRates();
Console.WriteLine(result);
Response:
Success: {"data": { "local_did_cost":"1.00", "inbound_call_rate":"0.01", "vps_server_rate":"24.00", "ccrf":"18.80" }}
countryList [GET]
List available countries list for international calls
Request Method and URL: GET https://api2.questblue.com/account/countrylist
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/account/countrylist
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Get country list and store the response
$country_list = $account->countryList();
//Display the country list on the page
print($country_list);
?>
string result = _account.CountryList();
Console.WriteLine(result);
Response:
Success: {"data" [ { "country_id":2689, "country_name":"AFGHANISTAN" }, …. { "country_id":2919, "country_name":"ZIMBABWE" } ]}
countryRate [GET]
List the service rates
Request Method and URL: GET https://api2.questblue.com/account/rates
Params to send:Values: (int) Any numerical country code
Description: Country ID
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/account/countryrate -d "{\"country_id\":2725}"
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Get country rates and store the response
$rates = $account->countryRate(2725); //2725 = CANADA HIGH COST AREA
//Display the rates on the page
print($rates);
?>
string result = _account.CountryRate("2865"); //2865 is the country id for SAUDI ARABIAs
Console.WriteLine(result);
Response:
Success: {"data": { "local_did_cost":"1.00", "inbound_call_rate":"0.01", "vps_server_rate":"24.00", "ccrf":"18.80" }}
Error: {"error":"Error Message"}
interRatesZone2 [GET]
Lists international call rates for Zone 2
Request Method and URL: GET https://api2.questblue.com/account/ratezone2
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/account/ratezone2
<?php
//Require the neccesary class once
require_once("api_v2/Account.php");
//Create a new instance of the class
$account = new Account;
//Get zone2 rates and store the response
$rates = $account->interRatesZone2();
//Display the rates on the page
print($rates);
?>
string result = _account.InterRatesZone2();
Console.WriteLine(result);
Response:
Success: {"data":[ { "destination":"American Samoa", "code":"1684", "rate":"0.1188" } ]}
Error: {"error":"Error Message"}
The Dids class gives you access to methods that control TNs in your DID inventory from ordering,updating,deleting and much more.
<?php
require_once("api_v2/Dids.php");
$dids = new Dids;
?>
string result = _account.InterRatesZone2();
Console.WriteLine(result);
listStates [GET]
List of states where at least one Rate Center is available
Request Method and URL: GET https://api2.questblue.com/did/states
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/did/states
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
//Grab the states list and store it for later use
$states_list = $dids->listStates();
//Print the states list to the screen
print($states_list);
?>
string result = _dids.ListStates();
Console.WriteLine(result);
Response:
Success: {"total":52, "data":["AA", … "WY"]}
listRateCenters [GET]
List of rate centers for a state
Request Method and URL: GET https://api2.questblue.com/did/ratecenters
Params to send:Values: (string) NC, SC
Description: Standard State abbreviation
Values: (string)0(no TF),1,1b(SMS avalable, no TF)
Description: TN Tier level
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/did/ratecenters -d "{\"state\": \"NC\",\"tier\": \"1b\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
$tier = "1b"; //SMS Enabled
$state = "NC";
//Grab the list of rate centers and store it for later use
$rate_centers_list = $dids->listRateCenters($tier,$state);
//Print the states list to the screen
print($rate_centers_list);
?>
string result = _dids.ListRateCenters();
Console.WriteLine(result);
Response:
Success: {"total":321, "data":{"ACME":"ACME","ZEBULON":"ZEBULON"}}
listAvailableDids [GET]
Get List of available DIDs - Local or Toll Free
Request Method and URL: GET https://api2.questblue.com/did/available
Params to send:Values: (string)local/tf(toll free)
Description: Type of TN (TF or Local)
Values: (string)1/1b/2
Description: Tier of TN to order(0 has no TF)(1 and 1b support SMS and have TF), 2 (no TF)
Values: (string)Two char state code, i.e. North Carolina = NC
Description: For Local TNs if not NPA entered
Values: (string)
Description: For Local TNs if not NPA entered
Values: (int) 5 Digits
Description: Is used for Local DIDs only. For tier 1b only. If ZIP is set then no NPA, state and rate center is required. The option takes precedence over state/rate center and NPA.
Values: (int) 3 digits
Description: Is used for Local DIDs only. If NPA is set then no state and rate center is required. The option takes precedence over state/rate center
Values: (int) two digits
Description: Toll Free code. For TF DIDs only.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/did/available -d "{\"type\": \"tf\",\"tier\":\"1b\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
$type = "tf";
$tier = "1b";
//Grab the list and store it for later use
$available_dids = $dids->listAvailableDids($type,$tier);
//Print the list to the screen
print($available_dids);
?>
ListAvailableDidsModel listAvailableDidsModel = new ListAvailableDidsModel(){
type = "tf",
tier = "1b"
};
string result = _dids.ListAvailableDids(listAvailableDidsModel);
Console.WriteLine(result);
Response:
Output: {"total":100,"data":["8448779235".............."8448874677","8448874679"]}
orderDid [POST]
Order Local or Toll Free DID
Request Method and URL: POST https://api2.questblue.com/did
Params to send:Values: (string)1/1b/2
Description: Tier of TN to order(0 has no TF)(1 and 1b support SMS and have TF), 2 (no TF)
Values: (int) 10 digits/(array) [2222222222, 3333333333, ...]
Description: Tn(s) to order
Values: (string) myTrunk
Description: SIP trunk to route the DID to. The trunk must be active.
Values: (string) on/off
Description: Enable/disable CNAM services
Values: (string) my note here
Description: TN note
Values: (int) 1235
Description: Port out security PIN code. 4 to 6 digits
Values: (string) 4 to 15 chars (set to empty string to remove)
Description: Set the CallerID name for the TN
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/did -d "{\"tier\": \"1b\",\"did\": 3332224444, \"note\": null}"
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
//Grab the response and store it for later use
$response = $dids->orderDid("1b","3332224444");
//Print the response to the screen
print($response);
?>
OrderDidModel didModel = new OrderDidModel(){
tier = "1b",
did = "3332224444"
};
string result = _dids.OrderDid(didModel);
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error): {"warning":["Warning Message"]}
Error: {"error":"Error Message"}
listDids [GET]
List Ordered DIDs and thier configurations
Request Method and URL: GET https://api2.questblue.com/did
Params to send:Values: (string) minimum 3 digits, 123..., 123*
Description: TN to get info on. Supports Unix style searching (globbing)
Values: (int) 5-200
Description: Number of records to list in a page. Default value is 25.
Values: (int)
Description: Page number to retrieve data from
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/did -d "{\"did\": \"333*\",\"per_page\": 25, \"page\": 3}"
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
//Grab the response and store it for later use
$did_list = $dids->listDids("333*","25","3");
//Print the list to the screen
print($did_list);
?>
string result = _dids.ListDids("333*","25","3");
Console.WriteLine(result);
Response:
Success: {"total":9, "total_pages":9, "current_page":1, "data":[{ "did":"9192138311", "status":"active", "tier":"1b", "type":"local", "note":"", "route2trunk":"", "lidb":"", "cnam":"", "e911":"", "failover":”” }] }
updateDid [PUT]
Manage Active DID Configuration and Settings
Request Method and URL: PUT https://api2.questblue.com/did
Params to send:Values: (int) 10 digits/(array) [2222222222, 3333333333, ...]
Description: Tn(s) to order
Values: (string) my note here
Description: TN note
Values: (int) 1235
Description: Port out security PIN code
Values: (string) myTrunk
Description: SIP trunk to route the DID to. The trunk must be active.
Values: (int)
Description: US based DID to forward inbound calls
Values: (array) [string]failover_ip_address = new IP address to set on experiencing timeout errors [int]failover_num = range 1 to 100, Number of offline calls received within failover_time required to trigger failover [int]failover_time = Time window(in minutes) that system will check for failover_num calls Possible Values 2,3,5,7,10,15,20,30
Description: Change trunk's IP address on experiencing a specific number of timeout errors(failover_num) within a specific time (failover_time)
Values: (string) 4 to 15 chars (set to empty string to remove)
Description: Set the CallerID name for the TN
Values: (string) on/off
Description: Enable/disable CNAM services
Values: (array)/(string) see E911 section below or set to empty to remove
Description: See E911 section below or set to empty to remove
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/did -d "{\"did\": 3332224444, \"note\": \"New note\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
//Grab the response and store it for later use
$response = $dids->updateDid("3332224444","New note");
//Print the response to the screen
print($response);
?>
UpdateDidModel didModel = new UpdateDidModel(){
did = "3332224444",
note = "New note"
};
string result = _dids.UpdateDid(didModel);
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error): {"warning":["Warning Message"]}
Error: {"error":"Error Message"}
deleteDid [DELETE]
Completely Remove DID from Inventory
Request Method and URL: DELETE https://api2.questblue.com/did
Params to send:Values: (int)
Description: TN to delete
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/did -d "{\"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
//Grab the response and store it for later use
$response = $dids->deleteDid("3332224444");
//Print the response to the screen
print($response);
?>
string result = _dids.DeleteDid("3332224444");
Console.WriteLine(result);
Response:
Success: empty
Error: {"error":"DID Ordering Error"}
move2fax [PUT]
Move voice DID to Fax Inventory
Request Method and URL: PUT https://api2.questblue.com/did/move2fax
Params to send:Values: (int)
Description: TN to move to fax
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/did/move2fax -d "{\"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Dids.php");
//Create a new instance of the class
$dids = new Dids;
//Grab the response and store it for later use
$response = $dids->move2fax("3332224444");
//Print the response to the screen
print($response);
?>
n/a
Response:
Success: empty
Error: {"error":"Error message"}
E911 Array Formatting
Not a call, but a reference for formatting E911 options arrays.
Setting this field to "no" will disable E911 options
Params to send:Values: (string)
Description: Name of the person or business registering for 911
Values: (string)
Description: City of the registered 911 customer
Values: (string)
Description: State of registered 911 customer
Values: (string)
Description: Zip code of registered 911 customer
Values: (string)
Description: Address of the registered 911 customer
Values: (string)
Description: Type of unit of the registered 911 customer
Values: (string)
Description: Unit number or letter of customer premise
n/a
n/a
n/a
Response:
n/a
The Ifax class gives you access to methods that control TNs in your fax inventory from ordering,updating,deleting and much more.
<?php
require_once("api_v2/Ifaxs.php");
$dids = new Ifaxs;
?>
string result = _account.InterRatesZone2();
Console.WriteLine(result);
listStates [GET]
List of states(short names) where at least one Rate Center is available
Request Method and URL: GET https://api2.questblue.com/fax/states
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax/states
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listStates();
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":52, "data":["AA", … "WY"]}
listRateCenters [GET]
List of Rate Centers for a State
Request Method and URL: GET https://api2.questblue.com/ratecenters
Params to send:Values: (string)
Description: Two char state name NC= North Carolina
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/ratecenters -d "{\"state\": \"AB\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listRateCenters("AB");
//Print the response to the screen
print($response);
?>
Response:
Output: {"total":217,"data":["ACADIA VLY","ACME""ROCKYMT HS","ROSEBUD","RUMSEY","RYCROFT"..........."WILLINGDON","WOKING","WRENTHAM","YOUNGSTOWN"]}
listAvailableDids [GET]
Get list of available Fax DIDs Local or toll free
Request Method and URL: GET https://api2.questblue.com/fax/available
Params to send:Values: (string)local,tf(toll free),tf is not available for tier 2
Description: TN type to list
Values: (string)
Description: For local TNs only.Required for Local DIDs if no NPA is entered
Values: (string)
Description: For local TNs only.Required for Local DIDs if no NPA is entered
Values: (int) 5 digits
Description: For local TNs only.For tier 1b only. If ZIP is set then no NPA,state, or ratecenter is required.
Values: (int) 3 digits
Description: For local TNs only.If NPA is set then no state and rate center is required.
Values: (int) 2 character TF code
Description: For TF TNs only
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax/available -d "{\"type\": \"1b\",\"state\": \"NC\",\"ratecenter\": \"RALEIGH\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listAvailableDids("1b","NC","RALEIGH");
//Print the response to the screen
print($response);
?>
Response:
Output: {"total":107,"data":["9194108535"..........."9842389679","9842389683","9842389686"]}
orderDid [POST]
Order Local or Toll Free fax pro DID/ Create and configure Ifax enterprise account
Request Method and URL: POST https://api2.questblue.com/fax2
Params to send:Values: (int)
Description: Fax DID to order
Values: (string)
Description: Group short name to add to the fax number. The group must be created before ordering the DID
Values: (string)
Description: Fax DID note
Values: (int) 4 digits
Description: Port Out Security PIN code.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2 -d "{\"did\": 3332224444,\"sname\": \"QB\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->orderDid("3332224444","QB");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
listDids [GET]
List Ordered DIDs and thier configurations
Request Method and URL: GET https://api2.questblue.com/fax2
Params to send:Values: (string) min 3 chars
Description: Fax DID to retrieve info. Support for Unix style DID searching.
Values: (int)
Description: Number of records to list in a page. The default is 25.
Values: (int)
Description: Page number to retrieve data from.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax2
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listDids();
//Print the response to the screen
print($response);
?>
Response:
Output: {"total":1,"data":[{"did":9105050412,"status":"active","did_type":"local","sname":"marieifax2"}]}
updateDid [PUT]
Update iFaxEnterprise DID Properties
Request Method and URL: PUT https://api2.questblue.com/fax2
Params to send:Values: (int)
Description: Fax DID to manage
Values: (string)
Description: DID note
Values: (int) 4 digits
Description: Port Out Security PIN code
Values: (string)
Description: Group short name to update. Set an empty value to remove current group(delete Fax account)
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/fax2 -d "{\"did\": 3332224444, \"note\",\"Test Note\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->updateDid("3332224444","Test Note");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
deleteDid [DELETE]
Remove iFax Enterprise DID
Request Method and URL: DELETE https://api2.questblue.com/fax2
Params to send:Values: (int)
Description: TN to delete
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/fax2 -d "{\"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->deleteDid("3332224444");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
createGroup [POST]
Create iFax Group of users(company)
Request Method and URL: POST https://api2.questblue.com/fax2/group
Params to send:Values: (stirng) max 24 characters
Description: Group short name
Values: (stirng) max 128 characters
Description: Group name
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2/group -d "{\"sname\": \"qb\", \"name\": \"QuestBlue\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->createGroup("qb","QuestBlue");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
listGroups [GET]
List iFax Groups(companies) and thier properties
Request Method and URL: GET https://api2.questblue.com/fax2/group
Params to send:Values: (string)
Description: Group short name to show group's information
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax2/group
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listGroups();
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":2, "data":[ {"sname":"shortName1", name":"long Name1"}, {"sname":"shortName1","name":"long Name2"} ] }
updateGroup [PUT]
Update iFax Groups(companies) amd thier properties
Request Method and URL: PUT https://api2.questblue.com/fax2/group
Params to send:Values: (string)
Description: Existing group short name to modify
Values: (string) max 24 chars
Description: New group short name
Values: (string) max 128 chars
Description: New group name
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/fax2/group -d "{\"sname\": qb, \"sname_new\": \"QB\",\"name_new\": \"QuestBlue\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->updateGroup("qb","QB","QuestBlue");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
deleteGroup [DELETE]
Completely Remove iFax Enterprise Group
Request Method and URL: DELETE https://api2.questblue.com/fax2/group
Params to send:Values: (string)
Description: Group short name to remove
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/fax2/group -d "{\"sname\": \"QB\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->deleteGroup("QB");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
createUser [POST]
Create new iFax Enterprise User for iFax Group
Request Method and URL: POST https://api2.questblue.com/fax2/user
Params to send:Values: (string) Max 36 chars
Description: Fax user login
Values: (string) Max 64 chars
Description: Fax user password
Values: (string)
Description: Group short name to add new user to
Values: (string) Max 48 chars
Description: Fax user first name
Values: (string) Max 48 chars
Description: Fax user last name
Values: (string)
Description: Fax user contact email. Must be a valid email
Values: (string) on/off(default)
Description: Set the user admin privileges
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2/user -d "{\"fax_login\": \"some_username\", \"fax_password\": \"some_password\", \"sname\": \"QB\", \"fax_name\": \"qbdev\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->createUser("some_username","some_password","QB","qbdev");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
listUsers [GET]
List existing iFax Enterprise Users
Request Method and URL: GET https://api2.questblue.com/fax2/user
Params to send:Values: (string)
Description: Fax group short name to view details
Values: (string)
Description: Fax user login to view details
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax2/user -d "{\"sname\": \"QB\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listUsers("QB");
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":10, "total_pages":2, "current_page":1, "data"[ {"sname":"myGroupName", "fax_name":"John", "fax_lname":"Doe" "login":"mylogin", "password":"myPassword", "is_admin":"on"} …. ]}
Error: {"error":"Error message"}
updateUser [PUT]
Manage iFax Enterprise User Properties
Request Method and URL: PUT https://api2.questblue.com/fax2/user
Params to send:Values: (string)
Description: Fax user login to modify. The user must exist in your inventory
Values: (string) Max 64 chars
Description: Fax user password
Values: (string) Max 48 chars
Description: Fax user first name
Values: (string)
Description: Fax user last name
Values: (string)
Description: Fax user contact email. Must be a valid email
Values: (string) on/off(default)
Description: Set the user admin privileges.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/fax2/user -d "{\"fax_login\": \"fax_username\", \"is_admin\": \"on\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->updateUser("some_username",null,null,null,null,"on");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
deleteUser [DELETE]
Completely remove iFax Enterprise User
Request Method and URL: DELETE https://api2.questblue.com/fax2/user
Params to send:Values: (string)
Description: Fax user login to modify. The user must exist in your inventory
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/fax2/user -d "{\"fax_login\": \"some_username\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->deleteUser("some_username");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
updateUserPermissions [POST]
Create or Update iFax Enterprise User Permissions
Request Method and URL: POST https://api2.questblue.com/fax2/permit
Params to send:Values: (string)
Description: Fax User Login to manage permissions,The user must exist in your inventory
Values: (int)
Description: Fax DID to manage permissions. Must be active DID.
Values: (string) on/off
Description: Allow fax sending
Values: (string) on/off
Description: Allow fax deletion
Values: (string) on/off
Description: Allow viewing of inbound faxes
Values: (string) on/off
Description: Allow viewing of outbound faxes.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2/permit -d "{\"fax_login\": \"some_username\", \"did\": 3332224444, \"allow_send\": \"on\", \"allow_delete\": \"on\", \"allow_list_in\": \"on\", \"list_sent\": \"on\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->updateUserPermissions("some_username","3332224444","on","on","on","on");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
listUserPermissions [GET]
List iFax Enterprise Users Permissions
Request Method and URL: GET https://api2.questblue.com/fax2/permit
Params to send:Values: (string)
Description: Fax user login to show permissions
Values: int
Description: Fax Enterprise DID to show permissionss
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax2/permit -d "{\"fax_login\": \"some_username\", \"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listUserPermissions("some_usernmae","3332224444");
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":1,"data":[{"create_date":"Feb 3, 2020","fax_login":"<fax_username>","did":<fax_did>,"allow_send":"on","allow_delete":"on","allow_list_in":"on","allow_list_out":"on"}]}
Error: {"error":"Error message"}
deleteUserPermissions [DELETE]
Delete iFax Enterprise User Permissions
Request Method and URL: DELETE https://api2.questblue.com/fax2/permit
Params to send:Values: (string)
Description: Fax user login to delete4 permissions
Values: (int)
Description: Fax Enterprise DID to delete permissions
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/fax2/permit -d "{\"fax_login\": \"some_username\", \"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->deleteUserPermissions("some_username","3332224444");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
updateEmailPermissions [POST]
Create or Update iFax Enterprise Email Permissions
Request Method and URL: POST https://api2.questblue.com/fax2/email
Params to send:Values: (int)
Description: Fax Enterprise DID to set email permissions
Values: (string)
Description: Email address to set permissions
Values: (string)
Description: Allow send faxes
Values: (string)
Description: Allow Receive faxes
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2/email -d "{\"did\", 3332224444, \"email\": \"some_email@example.com\", \"allow_send\": \"on\", \"allow_recieve\": \"on\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->updateEmailPermissions("3332224444","some_email@example.com","on","on");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
listEmailPermissions [POST]
List iFax Enterprise email permissions inventory
Request Method and URL: POST https://api2.questblue.com/fax2/email
Params to send:Values: (int)
Description: Fax Enterprise DID to list email permissions
Values: (string)
Description: Email address to list email permissions
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2/email -d "{\"did\": 3332224444, \"email\": \"some_email@example.com\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->listEmailPermissions("3332224444","some_email@example.com");
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":10, "total_pages":2, "current_page":1, "data":[ {"sname":"myFaxLogin","did":"3025490877", "email":"john@doe.com", "allow_send":"on", "allow_receive":"on"}, …. ]}
Error: {"error":"Error message"}
deleteEmailPermissions [DELETE]
Delete iFax Enterprise email permissions record
Request Method and URL: GET https://api2.questblue.com/fax2/email
Params to send:Values: (int)
Description: Fax Enterprise DID to delete email permissions
Values: (string)
Description: Email address to delete email permissions
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/fax2/email -d "{\"did\": 3332224444, \"email\": \"some_email@example.com\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->deleteEmailPermissions("3332224444","some_email@example.com");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
uploadFile [POST]
Upload fax file to fax server
Request Method and URL: POST https://api2.questblue.com/fax2/upload
Params to send:Values: (string) Max file size to upload: 5MB
Description: Base 64 encoded file content string
Values: (string)
Description: Uploaded file name
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2/upload -d "{\"file\": \"base64_encode_string\", \"filename\": \"image.png\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
$imageLink = "https://storage.googleapis.com/gd-wagtail-prod-assets/images/evolving_google_identity_2x.max-4000x2000.jpegquality-90.jpg";
//Grab the response and store it for later use
$response = $ifaxenterprise->uploadFile($imageLink,"image_of_google.jpg");
//Print the response to the screen
print($response);
?>
Response:
Success: {"data":{"fax_id":674944}}
Error: {"error":"Error message"}
sendFax [POST]
Send iFax
Request Method and URL: POST https://api2.questblue.com/fax2/send
Params to send:Values: (int) 10 digits
Description: Sender fax number. Must be active DID from your account
Values: (int) 10 digits
Description: US based destination fax number
Values: (int)
Description: Uploaded File ID
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax2/send -d "{\"did_from\": 3332224444, \"did_to\": 1112223333, \"file_id\": 1}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxenterprise.php");
//Create a new instance of the class
$ifaxenterprise = new Ifaxenterprise;
//Grab the response and store it for later use
$response = $ifaxenterprise->sendFax("3332224444","1112223333","1");
//Print the response to the screen
print($response);
?>
Response:
Success: {"data":{"fax_id":674944}}
Error: {"error":"Error message"}
The Vfax class gives you access to methods that control TNs in your fax inventory from ordering,updating,deleting and much more.
<?php
require_once("api_v2/Ifaxpro.php");
$dids = new Ifaxpro;
?>
listStates [GET]
List of states(short names) where at least one Rate Center is available
Request Method and URL: GET https://api2.questblue.com/fax/states
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax/states
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->listStates();
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":52, "data":["AA", … "WY"]}
listRateCenters [GET]
List of Rate Centers for a State
Request Method and URL: GET https://api2.questblue.com/ratecenters
Params to send:Values: (string) 2 chars
Description: Two character standard state abbreviation North Carolina = NC
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/ratecenters -d "{\"state\: \"AB\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->listRateCenters("AB");
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":321, "data":{"ACME":"ACME", ... "ZEBULON":"ZEBULON"}}
listAvailableDids [GET]
Get list of available Fax DIDs Local or toll free
Request Method and URL: GET https://api2.questblue.com/fax/available
Params to send:Values: (string)local,tf(toll free)
Description: TF is not available for tier 2
Values: (string)
Description: For local TNs only. Required for Local DIDs if no NPA is entered.
Values: (string)
Description: For local TNs only. Required for Local DIDs if no NPA is entered.
Values: (int) 5 digits
Description: For local TNs only. For tier 1b only. If ZIP is set then no NPA,state, or ratecenter is required.
Values: (int) 3 digits
Description: For local TNs only. If NPA is set then no state and rate center is required.
Values: (int) 2 digits
Description: For TF TNs only.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax/available -d "{\"type\": \"1b\", \"state\": \"state\": \"NC\", \"ratecenter\": \"RALEIGH\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->listAvailableDids("1b","NC","RALEIGH");
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":20", data":["9194911062", … "9196989686"]}
orderDid [POST]
Order Local or Toll Free fax pro DID/ Create and configure Ifax pro account
Request Method and URL: POST https://api2.questblue.com/fax
Params to send:Values: (int)
Description: Fax Tn to order
Values: (string)
Description: Fax TN note
Values: (int) 4 digits
Description: Port out security PIN code
Values: (string)
Description: Fax username
Values: (string)
Description: Fax user email address
Values: (string)
Description: Fax user login
Values: (string)
Description: Fax user password
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax -d "{\"did\": 3332224444, \"fax_name\": \"some_name\", \"fax_email\": \"some_email@example.com\", \"fax_login\": \"some_username\", \"fax_password\": \"some_password\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->orderDid("3332224444","","","some_name","some_email@example.com","some_username","some_password");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
listDids [GET]
List Ordered DIDs and thier configurations
Request Method and URL: GET https://api2.questblue.com/fax
Params to send:Values: (string) Min 3 char
Description: Fax DID to retrieve info. Support for Unix style DID searching.
Values: (int)
Description: Number of records to list in a page. The default is 25
Values: (int)
Description: Page number to retrieve data from
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/fax
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->listDids();
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":6, "total_pages":1, "current_page":1, "data":[ {"did":"9194911062", "status":"active", "did_type":"local", "note":"DID Note", "fax_name":"John Doe", "fax_login":"mylogin"},…. ]}
updateDid [PUT]
Manage Active Fax DID Configuration and Settings
Request Method and URL: PUT https://api2.questblue.com/fax
Params to send:Values: (int)
Description: Fax TN to manage
Values: (string)
Description: TN note
Values: (int) min 4 digits
Description: Port out security PIN code
Values: (string)
Description: Remove Fax account. This method has a priority of fax name,email,login,password parameters assigned in the same request
Values: (string)
Description: Fax username
Values: (string)
Description: Fax user email address
Values: (string)
Description: Fax user login
Values: (string)
Description: Fax user password
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/fax -d "{\"did\": 3332224444, \"note\": \"This is a test note\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->updateDid("3332224444","This is a test note");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Warning (Non Critical Error): {"warning":["Warning Message"]}
Error: {"error":"Error message"}
deleteDid [DELETE]
Manage Active Fax DID Configuration and Settings
Request Method and URL: DELETE https://api2.questblue.com/fax
Params to send:Values: (int)
Description: Fax TN to remove
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/fax -d "{\"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->deleteDid("3332224444");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Warning (Non Critical Error): {"warning":["Warning Message"]}
Error: {"error":"Error message"}
sendFax [POST]
Send iFax
Request Method and URL: POST https://api2.questblue.com/fax/send
Params to send:Values: (string) jpeg, jpg, gif, png, tif, tiff, pdf, doc, rtf, ods, xls, csv, ppt, txt, rar, zip, 7z4
Description: Base 64 encoded file content string. Maximum file size to upload 5Mb
Values: (string)
Description: Uploaded file name
Values: (int) active TN from your account
Description: Sender Fax Number
Values: (int)
Description: Ten digit US-based Destination Fax Number.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/fax/send -d "{\"did_from\": 3332224444, \"did_to\": 1112223333, \"file\": \"https://example.com/image.png\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->sendFax("3332224444","1112223333","/relative/path/to/file.pdf");
//Print the response to the screen
print($response);
?>
Response:
Success: {"data":{"fax_id":674944}}
Error: {"error":"Error message"}
move2voice [PUT]
Move Fax DID to Voice Inventory
Request Method and URL: PUT https://api2.questblue.com/fax/move2voice
Params to send:Values: (int)
Description: TN to move
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/fax/move2voice -d "{\"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Ifaxpro.php");
//Create a new instance of the class
$ifaxpro = new Ifaxpro;
//Grab the response and store it for later use
$response = $ifaxpro->move2voice("3332224444");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"Error message"}
The Interdids class gives you access to methods that control international TNs in your inventory from ordering,updating,deleting and much more.
<?php
//Require the neccesary class once
require_once("api_v2/Interdids.php");
//Create a new instance of the class
$interdids = new Interdids;
?>
listCountries [GET]
Get Available Country List
Request Method and URL: GET https://api2.questblue.com/didinter/countrylist
Params to send:curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/didinter/countrylist
<?php
//Require the neccesary class once
require_once("api_v2/Interdids.php");
//Create a new instance of the class
$interdids = new Interdids;
//Grab the response and store it for later use
$response = $interdids->listCountries();
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":43, "data":[ {"code":"DZ","country":"Algeria"}, …. {"code":"VN","country":"Vietnam"} ]}
listCities [GET]
Get Available City List
Request Method and URL: GET https://api2.questblue.com/didinter/citylist
Params to send:Values: (string)Two char country code obtained from listCountries
Description: Two letter standard country abbreviation
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/didinter/citylist -d "{\"country_code\": \"DZ\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Interdids.php");
//Create a new instance of the class
$interdids = new Interdids;
//Grab the response and store it for later use
$response = $interdids->listCities("DZ");
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":21, "data":[ "BAHIA BLANCA", …. "VILLA MERCEDES" ]}
orderDid [POST]
Order International DID
Request Method and URL: POST https://api2.questblue.com/didinter
Params to send:Values: (string) Two char country code obtained from listCountries
Description: Two letter standard country abbreviation
Values: (string)
Description: City name obtained from listCities
Values: (string)
Description: Route International DID to a SIP trunk. The trunk must be active. Set to empty to unroute the TN
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/didinter -d "{\"country_code\": \"DZ\", \"city\": \"NATIONAL VOIP\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Interdids.php");
//Create a new instance of the class
$interdids = new Interdids;
//Grab the response and store it for later use
$response = $interdids->orderDid("DZ","NATIONAL VOIP");
//Print the response to the screen
print($response);
?>
Response:
Success: {"did":2234567891}
Warning: {"did":2234567891," warning":{"forward2did":"Set DID forwarding Error"}}
Error: {"error":"DID Ordering Error"}
listDids [GET]
Get International DIDs List and Properties
Request Method and URL: GET https://api2.questblue.com/didinter
Params to send:Values: (int)
Description: DID to retrieve info from
Values: (int) Default 25, range is 5 to 200
Description: Number of records to list in a page.
Values: (int)
Description: Page number to retrieve data from
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/didinter -d "{\"did\": 3332224444, \"per_page\": 10, \"page\": 2}"
<?php
//Require the neccesary class once
require_once("api_v2/Interdids.php");
//Create a new instance of the class
$interdids = new Interdids;
//Grab the response and store it for later use
$response = $interdids->listDids("3332224444",10,2);
//Print the response to the screen
print($response);
?>
Response:
Success: {"total":17, "total_pages":4, "current_page":1, "data"[ {"did":"582127202550", "country":"Venezuela", "city":"CARACAS", "status":"active", "route2trunk":"trunkName"}, ... ]}
Error: {"error":"No International DIDs Found"}
updateDid [PUT]
Get International DIDs List and Properties
Request Method and URL: PUT https://api2.questblue.com/didinter
Params to send:Values: (int)
Description: TN to manage
Values: (string)
Description: Route International DID to a SIP trunk. The trunk must be active. Set an empty value to unroute the DID.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/didinter -d "{\"did\": 3332224444, \"route2trunk\": \"my_trunk\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Interdids.php");
//Create a new instance of the class
$interdids = new Interdids;
//Grab the response and store it for later use
$response = $interdids->updateDid("3332224444","my_trunk");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"DID Ordering Error"}
deleteDid [DELETE]
Completely Delete International DID
Request Method and URL: DELETE https://api2.questblue.com/didinter
Params to send:Values: (int)
Description: TN to delete
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/didinter -d "{\"did\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Interdids.php");
//Create a new instance of the class
$interdids = new Interdids;
//Grab the response and store it for later use
$response = $interdids->deleteDid("3332224444");
//Print the response to the screen
print($response);
?>
Response:
Success: empty
Error: {"error":"DID removal error"}
The LNP class gives you access to methods that relate to LNP orders
<?php
require_once("api_v2/Lnp.php");
$lnp = new Lnp;
?>
private APICredential _apiCredential = new APICredential("username","password","privkey");
private LNP _lnp = new LNP(_apiCredential);
checkPortability [GET]
Check local number portability for specific TN
Request Method and URL: GET https://api2.questblue.com/lnp/check
Params to send:Values: (int)/(array)
Description: US TN to check portability
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/lnp/check -d "{\"number2port\": 3332224444}"
<?php
//Require the neccesary class once
require_once("api_v2/Lnp.php");
//Create a new instance of the class
$lnp = new Lnp;
//Grab the response and store it for later use
$response = $lnp->checkPortability("3332224444");
//Print the response to the screen
print($response);
?>
string result = _lnp.CheckPortability("3332224444");
Console.WriteLine(result);
Response:
Success: {"data":{"foc_days":3}}
Error: {"error":"Error Message"}
createLnp [POST]
Create new local number portability request
Request Method and URL: POST https://api2.questblue.com/lnp
Params to send:Values: (int)
Description: US based porting TN
Values: (string)Maxx 255 chars
Description: Current server provider name
Values: (string)
Description: Server provider account number
Values: (string)
Description: Authorized contact
Values: (string)
Description: Contact title
Values: (string)Max 100 chars
Description: Street name
Values: (string)Max 50 chars
Description: Service street number
Values: (string)Max 100 chars
Description: Service city
Values: (string)
Description: Service state
Values: (mixed)Max 20 chars
Description: Service zipcode
Values: (int)Ten chars
Description: US based billing telephone number
Values: (string)GIF, JPG, PNG or PDF file. Size up to 5Mb.
Description: Base64 encoded full path phone bill files (scan, photo).
Values: (string)Format YYYY-MM-DD
Description: Request FOC date. Is not available when porting mobile DID
Values: (string)Format HH:00(EST)
Description: Request FOC activation (only 9am-4pm EST available)
Values: (string)voice,fax,Default voice
Description: Type of DID
Values: (string)yes,no, Default no
Description: Partial port
Values: (string)
Description: Additional remaining services. Required if partial_port is set to yes
Values: (string)business,residential
Description: Service Location
Values: (string)
Description: Company Name. Required if location is set to business
Values: (string)yes,no, Default no
Description: Wireless number type
Values: (int)
Description: Wireless account PIN code. Required if wireless_no is set to yes
Values: (int)
Description: SSN last four digits. Required if wireless_no is set to yes
Values: (string)yes,no, Default no
Description: LIDB/Directory listings
Values: (string)None, N, NE, E, SE, S, SW, W, NW. Max. 10 chars
Description: Dir prefix
Values: (string)None, N, NE, E, SE, S, SW, W, NW. Max. 10 chars
Description: Dir suffix
Values: (string)Max 100 chars
Description: Service suite/unity
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/lnp -d "{\"number2port\": 3332224444, \"provider_name\": \"Verizon\", \"account_no\": \"11111\", \"authorize_contact\": \"john doe\", \"contact_title\": \"ceo/owner\", \"street_name\": \"park avenue\", \"street_no\": \"1775\", \"city\": \"new york\" , \"zipcode\": \"23405\", \"billing_telephone_no\": 3332224444, \"bill_file\": \"base64_encoded_bill_file\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Lnp.php");
//Create a new instance of the class
$lnp = new Lnp;
//associative array of data for lnp request
$data = array(
"number2port" => [3332224444],
"provider_name" => "Verizon",
"account_no" => "11111",
"authorize_contact" => "john doe",
"contact_title" => "ceo/owner",
"street_name" => "park avenue",
"street_no" => "1775",
"city" => "new york",
"zipcode" => "23405",
"billing_telephone_number" => "3332224444",
"bill_file" => "http://linktoimage.com/image.png"
);
//Grab the response and store it for later use
$response = $lnp->createLnp($data);
//Print the response to the screen
print($response);
?>
CreateLNPModel lnpModel = new CreateLNPModel(){
"number2port" = "3332224444" ,
"provider_name" = "Verizon" ,
"account_no" = "11111" ,
"authorize_contact" = "john doe" ,
"contact_title" = "ceo/owner" ,
"street_name" = "park avenue" ,
"street_no" = "1775" ,
"city" = "new york" ,
"zipcode" = "23405" ,
"billing_telephone_no" = "3332224444" ,
"bill_file" = "http://linktoimage.com/image.png" ,
"bill_filename" = "image.png"
};
string result = _lnp.CreateLnp(lnpModel);
Console.WriteLine(result);
Response:
Success: {"data":[ {"id":"12345" ] }
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
listLnp [GET]
List active local number portability request
Request Method and URL: GET https://api2.questblue.com/lnp
Params to send:Values: (int)/(string)
Description: Porting numbers to list properties. The method suppoorts unix style porting number searching
Values: (int)/(array)
Description: The LNP carrier ID
Values: (int) range 1 to 200 default of 10
Description: Number of records to show per page.
Values: (int)
Description: Page to show
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/lnp
<?php
//Require the neccesary class once
require_once("api_v2/Lnp.php");
//Create a new instance of the class
$lnp = new Lnp;
//Grab the response and store it for later use
$response = $lnp->listLnp();
//Print the response to the screen
print($response);
?>
string result = _lnp.ListLnp();
console.WriteLine(result);
Response:
Success: {"total":18, "total_pages":2, "current_page":1, "data":[ {"number2port":"2232333844", "id":"12345", "created_by":"1970-01-01T00:00:00+00:00", "status":"submitted", "foc_date":"2019-04-12T17:00:00+00:00", "did_mode":"voice", "trunk":"myTrunkName", "partial_port":"no", "location":"business", "company":"My Company Name", "wireless_no":"no", "lidb_list":"no", "provider_name":"My Provider Name", "account_no":"111", "authorize_contact":"John Doe", "contact_title":"CEO", "street_no":"13", "dir_prefix":"None", "street_name":"Park Avenue", "dir_suffix":"NE", "service_unit":"87", "city":"Houston", "zipcode":"55346", "billing_telephone_no":"3032051420"}, …. ] }
updateLnp [PUT]
Update an existing local number portability request
Request Method and URL: PUT https://api2.questblue.com/lnp
Params to send:Values: (int)
Description: id of LNP request
Values: (string)
Description: SIP trunk name to route DID on porting complete(For voice dids Only)
Values: (string)Maxx 255 chars
Description: Current server provider name
Values: (string)
Description: Server provider account number
Values: (string)
Description: Authorized contact
Values: (string)
Description: Contact title
Values: (string)Max 100 chars
Description: Street name
Values: (string)Max 50 chars
Description: Service street number
Values: (string)Max 100 chars
Description: Service city
Values: (string)
Description: Service state
Values: (mixed)Max 20 chars
Description: Service zipcode
Values: (int)Ten chars
Description: US based billing telephone number
Values: (string)GIF, JPG, PNG or PDF file. Size up to 5Mb.
Description: Base64 encoded full path phone bill files (scan, photo).
Values: (string)Format YYYY-MM-DD
Description: Request FOC date. Is not available when porting mobile DID
Values: (string)Format HH:00(EST)
Description: Request FOC activation (only 9am-4pm EST available)
Values: (string)voice,fax,Default voice
Description: Type of DID
Values: (string)yes,no, Default no
Description: Partial port
Values: (string)
Description: Additional remaining services. Required if partial_port is set to yes
Values: (string)business,residential
Description: Service Location
Values: (string)
Description: Company Name. Required if location is set to business
Values: (string)yes,no, Default no
Description: Wireless number type
Values: (int)
Description: Wireless account PIN code. Required if wireless_no is set to yes
Values: (int)
Description: SSN last four digits. Required if wireless_no is set to yes
Values: (string)yes,no, Default no
Description: LIDB/Directory listings
Values: (string)None, N, NE, E, SE, S, SW, W, NW. Max. 10 chars
Description: Dir prefix
Values: (string)None, N, NE, E, SE, S, SW, W, NW. Max. 10 chars
Description: Dir suffix
Values: (string)Max 100 chars
Description: Service suite/unity
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/lnp -d "{\"id\": 0000, \"provider_name\": \"verizon\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Lnp.php");
//Create a new instance of the class
$lnp = new Lnp;
//associative array of data for lnp request
$data = array(
"number2port" => "0000",
"provider_name" => "verizon"
);
//Grab the response and store it for later use
$response = $lnp->updateLnp($data);
//Print the response to the screen
print($response);
?>
UpdateLNPModel updateLnpModel = new UpdateLNPModel{
id = "0000",
provider_name = "verizon"
};
string result = _lnp.UpdateLnp(updateLnpModel);
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
deleteLnp [DELETE]
Remove Active Local Number Portability Request
Request Method and URL: DELETE https://api2.questblue.com/lnp
Params to send:Values: (int)
Description: The LNP order ID to cancel
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/lnp -d "{\"id\": 0000}"
<?php
//Require the neccesary class once
require_once("api_v2/Lnp.php");
//Create a new instance of the class
$lnp = new Lnp;
//Grab the response and store it for later use
$response = $lnp->deleteLnp("0000");
//Print the response to the screen
print($response);
?>
string result = _lnp.DeleteLnp("0000");
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
The Reports class gives you access to methods that retrieve data on for specific services
<?php
require_once("api_v2/Reports.php");
$reports = new Reports;
?>
private APICredential _apiCredential = new APICredential("username","password","privkey");
private Reports _reports = new Reports(_apiCredential);
callHistory [GET]
Retrieve voice call history for a customer account, filtered by additional options
Request Method and URL: GET https://api2.questblue.com/callhistory
Params to send:Values: (string)
Description: SIP Trunk name to retrieve calls.
Values: (mixed)
Description: Date options to see history. )Possible values: thishour– calls in this hour. Sending this request at 16:24 will return calls made within the range from 16:00 to 16:24 previoushour– calls in the previous hour. Sending this request at 16:24 will return calls made within the range from 15:00 to 16:00 today(default)– today's calls from 00:00 to current time yesterday– yesterday’s calls. Sending request at Jan 12, 16:24 will return calls made by Jan 11 within the range from 00:00 to 23:59 array[startDate, endDate] – Date range where startDate, endDate – unix Time Stamp. Maximal date range allowed - seven days
Values: (string) on/off
Description: Show successful calls only
Values: (int)
Description: Retrieve specific TN history
Values: (string) on/off
Description: Display call summary only
Values: (int) 5 to 5000 default of 25
Description: Number of records to list in a page
Values: (int)
Description: Page number to display
Values: (string)in/out
Description: Call type (direction) required if did is set
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/callhistory -d "{\"period\": [1580515200,1580860800]}"
<?php
//Require the neccesary class once
require_once("api_v2/Reports.php");
//Create a new instance of the class
$reports = new Reports;
//Grab the response and store it for later use
$response = $reports->callHistory(null,[1641013200,1642827600]);
//Print the response to the screen
print($response);
?>
CallHistoryModel callHistoryModel = new CallHistoryModel()
{
period = new int[] { 1641013200, 1642827600 }
};
string response = _reports.CallHistory(callHistoryModel);
Console.WriteLine(response);
Response:
Success: Call Summary {"total":2, "data":[ {"call_type":"Outbound Local Call", "call_number":25, "total_duration_min":"10.00", "cost":"0.12"}, …. ]} Detailed Report {"total":10, "total_pages":2, "current_page":1, "data":[ {"call_time":"2019-01-17T05:00:01+00:00", (ISO 8601) "call_type":"Outbound Zone 2 Call", "caller":"13368467101", "callee":"8282021141", "call_status":"ok", "call_duration_min":"10.00", "billed_min":"10.00", "rate":"0.01", "ccrf":"0.002", "cost":"0.12"}, …. ]}
faxHistory [GET]
Retrive history of fax activity for a customer account, filtered by additional parameters
Request Method and URL: GET https://api2.questblue.com/faxhistory
Params to send:Values: (int)
Description: TN to list fax history
Values: (string) pro/enterprise
Description: Type of fax to list history- fax pro or fax enterprise
Values: (string) in,out
Description: List of inbound or outbound faxes
Values: (string)
Description: List only some specific fax by Fax ID
Values: (string)
Description: Time rand to list history
Values: (int) 10 to 200, default of 25
Description: Number of records to show per page
Values: (int)
Description: Page number to show
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/faxhistory -d "{\"service\": \"pro\", \"period\": [1580515200,1580947200]}"
<?php
//Require the neccesary class once
require_once("api_v2/Reports.php");
//Create a new instance of the class
$reports = new Reports;
//Grab the response and store it for later use
$response = $reports->faxHistory(null,"pro",null,null,[1641013200,1642827600]);
//Print the response to the screen
print($response);
?>
FaxHistoryModel callHistoryModel = new FaxHistoryModel()
{
period = new int[] { 1641013200, 1642827600 }
};
string response = _reports.CallHistory(callHistoryModel);
Console.WriteLine(response);
Response:
Success: {"total":49, "total_pages":10, "current_page":1, "data":[ {"fax_id":674949, "send_time":"2019-03-20T12:25:24+00:00", "did_from":"4037689155", "did_to":"4037689155", "type":"out", "service":"enterprise", "status":"processing"}, …. ]}
The Servers class gives you access to methods that allow the ordering, updating, and deleting of servers
require_once("api_v2/Servers.php");
$servers = new Servers;
private APICredential _apiCredential = new APICredential("username","password","privkey");
private Servers _servers = new Servers(_apiCredential);
orderServer [POST]
Regular or QuBe server - order a virtual or dedicated server
Request Method and URL: POST https://api2.questblue.com/server
Params to send:Values: (string) small/medium/large/enterprise
Description: Server type: Regular or QuBe(Graphical interface to asterisk installed) Available values and descriptions: small – Small Hosted Server Cores: 2 Ram: 2GB Disk Space: 10GB medium - Medium Hosted Server Cores: 4 Ram: 4GB Disk: 25GB large - Large Hosted Server Cores: 6 Ram: 8GB Disk: 50GB enterprise - Enterprise Server Cores: 8 Ram: 16GB Disk: 100GB enterprise_plus - Enterprise++ Server Cores: 8 Ram: 32GB Disk: 100GB
Values: (string) max 255 characters
Description: server note
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/server -d "{\"server_type\": \"dedicated\", \"note\": \"Note for support team\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Servers.php");
//Create a new instance of the class
$servers = new Servers;
//Grab the response and store it for later use
$response = $servers->orderServer("dedicated","Note for support team");
//Print the response to the screen
print($response);
?>
QubeServer qubeServer = new QubeServer(){
pbxadmin_password = "supersecurepassword",
email = "myemail@example.com",
inbound_trunk_name = "mytrunk"
};
string result = _server.OrderServer("small",qubeServer);
Console.WriteLine(result);
Response:
Success: {"data":{"server_id":10522}}
listServers [GET]
List inventory and properties of ordered servers
Request Method and URL: GET https://api2.questblue.com/server
Params to send:Values: (int)/(array)
Description: Server ID display
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/server -d "{\"server_id\": 1355}"
<?php
//Require the neccesary class once
require_once("api_v2/Servers.php");
//Create a new instance of the class
$servers = new Servers;
//Grab the response and store it for later use
$response = $servers->listServers("1355");
//Print the response to the screen
print($response);
?>
string result = _server.ListServers("1355");
Console.WriteLine(result);
Response:
Success: {"total":2,"data":[ {"server_id":10522, "type":"vrtual", "ordered_by":"2019-01-23", "allowed_ip":["10.0.2.1","10.0.2.2"], "status":"active"} …. ]}
addIp [PUT]
Add an IP address to list of allowed IPs
Request Method and URL: PUT https://api2.questblue.com/server/addip
Params to send:Values: (int)
Description: Server ID to ADD IP address
Values: (string)
Description: IP address to add
Values: (string) max 64 chars
Description: Note or comment
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/server/addip -d "{\"server_id\": 1355, \"ip_address\": \"127.0.0.1\", \"note\": \"This is just a test\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Servers.php");
//Create a new instance of the class
$servers = new Servers;
//Grab the response and store it for later use
$response = $servers->addIp("1355","127.0.0.1","This is just a test");
//Print the response to the screen
print($response);
?>
string result = _server.AddIp("1355", "127.0.0.1", "This is just a test");
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
deleteIp [DELETE]
Remove an IP address from allowed IP list
Request Method and URL: DELETE https://api2.questblue.com/server/deleip
Params to send:Values: (int)
Description: Server ID to remove ip from
Values: (string)
Description: Ip Address to remove from server
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/server/deleip -d "{\"server_id\": \"1355\", \"ip_address\": \"127.0.0.1\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Servers.php");
//Create a new instance of the class
$servers = new Servers;
//Grab the response and store it for later use
$response = $servers->deleteIp("1355","127.0.0.1");
//Print the response to the screen
print($response);
?>
string result = _server.DeleteIp("1355", "127.0.0.1");
Console.WriteLine(result);
Response:
Success: empty
Error: {"error":"Error message"}
deleteServers [DELETE]
Remove server from account
Request Method and URL: DELETE https://api2.questblue.com/server
Params to send:Values: (int)
Description: Server ID to delete
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/server -d "{\"server_id\": 1355}"
<?php
//Require the neccesary class once
require_once("api_v2/Servers.php");
//Create a new instance of the class
$servers = new Servers;
//Grab the response and store it for later use
$response = $servers->deleteServers("1355");
//Print the response to the screen
print($response);
?>
string result = _server.DeleteServers("1355");
Console.WriteLine(result);
Response:
Success: empty
Error: {"error":"Error message"}
The Siptrunks class gives you access to methods that allow the creation, updating, and deleting of siptrunks
<?php
require_once("api_v2/Siptrunks.php");
$siptrunks = new Siptrunks;
?>
private APICredential _apiCredential = new APICredential("username","password","privkey");
private Siptrunks _siptrunks = new Siptrunks(_apiCredential);
createTrunk [POST]
Create new SIP trunk or Registration
Request Method and URL: POST https://api2.questblue.com/siptrunk
Params to send:Values: (string) max 15 chars
Description: SIP Trunk Name to create. Two types of trunk are allowed – Static trunk and Registration. Must be unique within the system. Creating a Registration trunk must be allowed within your account by server admin.
Required, It must consist of alphanumeric characters and digits
Values: (string) min 4 chars, max 48 chars
Description: Alpha numeric only. Password will be assigined automatically if not set here.
Values: (string)
Description: Required for static trunks if no dynamic host is entered.
Values: (string)
Description: Host(domain name) with dynamic IP address. The system will check the IP address of the host and automatically update it if there are changes. Takes precedence over ip_address.
Values: (int)
Description: TN to route to the trunk. This must be an active TN not routed to any other trunk.
Values: (string on/off)
Description: Allow to make international calls. This option must be enabled for your account by a server admin.
Values: (int) range 1-1000
Description: Limit daily cost for international calls
Values: (array)
Description: Change trunks IP address on experiencing a specific number of timeout errors(failover_num) within a specific time(failover_time). Array – to set where: failover_ip_address (string)- new IP address to set on experiencing timeout errors failover_num(int)– range 1 to 100.Number of offline calls received within failover_time required to trigger failover failover_time(int) - Time window (in minutes) that system will check for failover_num calls. Possible values: 2, 3, 5, 7, 10, 15, 20, 30
Values: (int) set to 0 to remove limit
Description: Limit the maximum number of concurrent channels
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPOST https://api2.questblue.com/siptrunk -d "{\"trunk\": \"testingTrunk\", \"password\": \"testpass\", \"ip_address\": \"127.0.0.1\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Siptrunks.php");
//Create a new instance of the class
$siptrunks = new Siptrunks;
//Grab the response and store it for later use
$response = $siptrunks->createTrunk("mytrunk",null,"1.1.1.1");
//Print the response to the screen
print($response);
?>
CreateTrunkModel createTrunkModel = new CreateTrunkModel(){
trunk = "mytrunk",
ip_address = "1.1.1.1"
};
string result = _siptrunks.CreateTrunk(createTrunkModel);
Console.WriteLine(result);
Response:
Success: empty
Error: {"error":"Error message"}
listTrunks [GET]
Get properties for one specific trunk, or all trunks
Request Method and URL: GET https://api2.questblue.com/siptrunk
Params to send:Values: (string)/(array)
Description: SIP Trunk name to get. single trunk will display more info then an array
Values: (int) range 5 to 200, default of 25
Description: Number of records to list per page
Values: (int)
Description: Page number to retrieve data from
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/siptrunk
<?php
//Require the neccesary class once
require_once("api_v2/Siptrunks.php");
//Create a new instance of the class
$siptrunks = new Siptrunks;
//Grab the response and store it for later use
$response = $siptrunks->listTrunks();
//Print the response to the screen
print($response);
?>
string result = _siptrunks.ListTrunks();
Console.WriteLine(result);
Response:
Success: {"total":50, "total_pages":2, "current_page":1, "data":[ {"trunk":"myTrunkName ", "type":"static", "status":"on", "ip_address":"101.102.103.1", "routed_dids":["9194393755"], "inter_call":"on" }, …. ]}
updateTrunk [PUT]
Update properties for a specific trunk
Request Method and URL: PUT https://api2.questblue.com/siptrunk
Params to send:Values: (string)
Description: SIP trunk name to manage
Values: (string)
Description: New SIP trunk password
Values: (string) on/off
Description: Enable or dissable (lock) SIP trunk
Values: (string)
Description: Change SIP trunk IP address (for static trunks only)
Values: (string)
Description: Host(domain name) with dynamic IP address. The system will check IP address of the host and automatically update it on changing.
Values: (string) default = "disabled"
Description: Enable to allow international calls. The option itself must be enabled for your account by server admin
Values: (int) range 1 to 1000 (USD)
Description: Limit daily cost for international calls
Values: (array)
Description: Change trunks IP address on experiencing a specific number of timeout errors(failover_num) within a specific time(failover_time) (see createTrunk for more information)
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/siptrunk -d "{\"trunk\": \"testingTrunk\", \"password\": \"newtestpass\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Siptrunks.php");
//Create a new instance of the class
$siptrunks = new Siptrunks;
//Grab the response and store it for later use
$response = $siptrunks->updateTrunk("mytrunk","newtestpass");
//Print the response to the screen
print($response);
?>
UpdateTrunkModel updateTrunkModel = new UpdateTrunkModel()
{
trunk = "mytrunk",
password = "newtestpass"
};
string result = _siptrunks.UpdateTrunk(updateTrunkModel);
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
deleteTrunk [DELETE]
Completely remove specific SIP trunk
Request Method and URL: DELETE https://api2.questblue.com/siptrunk
Params to send:Values: (string)
Description: SIP trunk name to remove
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XDELETE https://api2.questblue.com/siptrunk -d "{\"trunk\": \"testtrunk\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Siptrunks.php");
//Create a new instance of the class
$siptrunks = new Siptrunks;
//Grab the response and store it for later use
$response = $siptrunks->deleteTrunk("mytrunk");
//Print the response to the screen
print($response);
?>
string result = _siptrunks.DeleteTrunk("mytrunk");
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
The SMS class gives you access to methods that control messaging (including MMS)
<?php
require_once("api_v2/Sms.php");
$sms = new Sms;
?>
private APICredential _apiCredential = new APICredential("username","password","privkey");
private SMS _sms = new SMS(_apiCredential);
listAvailableDids [GET]
List of supported SMS DIDs
Request Method and URL: GET https://api2.questblue.com/sms
Params to send:Values: (int)/(array)
Description: DID to retrieve info. The method supports Unix style DID searching
Values: (int) default of 25
Description: Number of records to list on a page
Values: (int)
Description: Page number to retrieve data from
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/sms
<?php
//Require the neccesary class once
require_once("api_v2/Sms.php");
//Create a new instance of the class
$sms = new Sms;
//Grab the response and store it for later use
$response = $sms->listAvailableDids();
//Print the response to the screen
print($response);
?>
string result = _sms.ListAvailableDids();
Console.WriteLine(result);
Response:
Success: {"total":10, "total_pages":2, "current_page":1, "data":[{ "did":"5876006899", "sms_enabled":"on", "sms_mode":"Email and XMPP", "email2forward":"john"}…. ]}
updateSmsConfig [PUT]
Set SMS availability and SMS settings
Request Method and URL: PUT https://api2.questblue.com/sms
Params to send:Values: (int)
Description: TN to manage
Values: (string) email/url/chat
Description: Set Messaging mode. email – Inbound SMS will be forwarded to Email. url – SMS will be posted to. chat - SMS will be used with wetext.pro service.
Values: (string)
Description: Email address to forward inbound messages to. Required if sms_mode is set to email
Values: (string)
Description: SMS will be sent to the specified URL on your server Following POST variables will be send: from - TN SMS message was sent from to - TN(from your account) SMS message was delivered to msg- SMS message body. Required if sms_mode set to url
Values: (string) form,json,xml
Description: URL posting method
Values: (string)
Description: Email address to associate with WeText account. Required if sms_mode set to chat.
Values: (string)
Description: Password to login to WeText account. Required if sms_mode set to chat.
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XPUT https://api2.questblue.com/sms -d "{\"did\": 3332224444, \"sms_mode\": \"url\", \"post2url\": \"http://example.com\", \"post2urlmethod\": \"form\"}"
<?php
//Require the neccesary class once
require_once("api_v2/Sms.php");
//Create a new instance of the class
$sms = new Sms;
//Grab the response and store it for later use
$response = $sms->updateSmsConfig("1112223333","url",null,null,null,"http://example.com","form");
//Print the response to the screen
print($response);
?>
SmsConfig smsConfig = new SmsConfig()
{
did = "1112223333",
sms_mode = "url",
post2url = "https://example.com"
};
string result = _sms.UpdateSmsConfig(smsConfig);
Console.WriteLine(result);
Response:
Success: empty
Warning (Non Critical Error):{"warning":["Warning Message"]}
Error: {"error":"Error message"}
sendMsg [POST]
Send SMS or MMS message to US based TN
Request Method and URL: POST https://api2.questblue.com/smsv2
Params to send:Values: (string)
Description: DID to send message. Must be active SMS enabled DID
Values: (array)
Description: US based DID to send message to
Values: (string)
Description: Text message to be sent
Values: (array)
Description: String array of media files to be sent
<?php
//Require the neccesary class once
require_once("api_v2/Sms.php");
//Create a new instance of the class
$sms = new Sms;
$media = array(
"https://somepicture.com/image.png",
"https://somepicture.com/image2.png"
);
//Grab the response and store it for later use
$response = $sms->sendMsg("1112223333","2223334444","Hello from PHP!",$media);
//Print the response to the screen
print($response);
?>
string result = _sms.SendSMS("1112223333",
new string[] {"2223334444"},
"Hello from C#!",
new string[]{"https://somepicture.com/image.png","https://somepicture.com/image2.png"});
Console.WriteLine(result);
Response:
Success: {"data":{"msg_id": 1110000222}}
Error: {"error":"Error Message"}
Receive Messsage [POST]
from: Number that sent the message
to: Array of numbers the message was sent to
text: The text that was sent
media: Array of media urls
segments: The amount of segments the message was split into
type: The type of message SMS/MMS
string from
string[] to
string text
string[] media
string segments
string type
<?php
$json = file_get_contents('php://input');
$json_data = json_decode($json,true);
$from = $json_data['from'];
$to = $json_data['to'];
$text = $json_data['text'];
$media = $json_data['media'];
$segments = $json_data['segments'];
$type = $json_data['type'];
//Do something with the variables
?>
Response:
Status Callback [POST]
Since Messaging V2 we automatically send a status callback to your endpoint once a message is delivered.
Note: For group messaging you will receive a status response for each individual number in the group message
From: Number that sent the message
To: Number the message was delivered to
Status: Status of the message (delivered/failed)
Reason: Reason the message was not delivered(Message was not delivered due to spam)
Segments: The amount of segments the message was split into
string reference_id
string from
string to
string status
string reason
string segments
<?php
$json = file_get_contents('php://input');
$json_data = json_decode($json,true);
$reference_id = $json_data['reference_id'];
$from = $json_data['from'];
$to = $json_data['to'];
$status = $json_data['status'];
$reason = $json_data['reason'];
$segments = $json_data['segments'];
//Do something with the variables
?>
Response:
checkDeliveryStatus [GET]
Retrieve Message Delivery Status
Request Method and URL: GET https://api2.questblue.com/smsv2/deliverystatus
Params to send:Values: (int)
Description: Sent message ID to check status of
curl -i -u <api_username>:<api_password> -H "Content-type: application/json" -H "Security-Key: <your_private_key>" -XGET https://api2.questblue.com/sms/deliverystatus -d -d "{\"msg_id\":1110000222}"
<?php
//Require the neccesary class once
require_once("api_v2/Sms.php");
//Create a new instance of the class
$sms = new Sms;
//Send a message and store the response
$response = $sms->sendMsg("3332224444","1112223333","This is just a test message");
//Turn json response back into a php object
$response_object = json_decode($response);
//Get message id
$msg_id = $response_object["msg_id"];
//Get the delivery status
$response = $sms->checkDeliveryStatus($msg_id);
//Print the response to the screen
print($response);
?>
string result = _sms.CheckDeliveryStatus("112233");
Console.WriteLine(result);
Response:
Success: {"data":{"status":"sent"}}
Error: {"error":"Error Message"}