コード例 #1
0
 /**
  * Download a given monthly call report using MTOM
  * @param  string     $fileName     Required parameter: The name of the report to download
  * @return binary response from the API call*/
 public function getCdrsFile($fileName)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/cdrs/cdrsfile/{fileName}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('fileName' => $fileName));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('User-Agent' => 'APIMATIC 2.0');
     //prepare API request
     $request = Unirest::get($queryUrl, $headers);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code < 200 || $response->code > 206) {
         //[200,206] = HTTP OK
         throw new APIException("HTTP Response Not OK", $response->code);
     }
     return $response->body;
 }
コード例 #2
0
 /**
  * Show information on a specific country
  * @param  string     $countryCodeA3     Required parameter: The three letter identifier for the country
  * @return mixed response from the API call*/
 public function getCountry($countryCodeA3)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/inventory/country/{countryCodeA3}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('countryCodeA3' => $countryCodeA3));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare API request
     $request = Unirest::get($queryUrl, $headers);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code < 200 || $response->code > 206) {
         //[200,206] = HTTP OK
         throw new APIException("HTTP Response Not OK", $response->code);
     }
     return $response->body;
 }
コード例 #3
0
 /**
  * Displays detailed information on a specific cart
  * @param  int     $cartIdentifier     Required parameter: The identifier of the cart
  * @return mixed response from the API call*/
 public function getCart($cartIdentifier)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     $queryBuilder = Config::get('voxbone.base_uri');
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/ordering/cart/{cartIdentifier}	';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('cartIdentifier' => $cartIdentifier));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('User-Agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare API request
     $response = Request::get($queryUrl, $headers);
     //and invoke the API call request to fetch the response
     //$response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code < 200 || $response->code > 206) {
         //[200,206] = HTTP OK
         return $response;
     }
     return $response->body;
 }
コード例 #4
0
 /**
  * Check if an address is valid to unblock numbers from a given country and type
  * @param  string     $addressId                    Required parameter: The address identifier
  * @param  string     $didType                      Required parameter: The number type
  * @param  string     $destinationCountryCodeA3     Required parameter: The three letter identifier for the country
  * @return mixed response from the API call*/
 public function getAddressValidation($addressId, $didType, $destinationCountryCodeA3)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     $queryBuilder = Config::get('voxbone.base_uri');
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/regulation/address/{addressId}/validation';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('addressId' => $addressId));
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($queryBuilder, array('didType' => $didType, 'destinationCountryCodeA3' => $destinationCountryCodeA3));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('User-Agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare API request
     $response = Request::get($queryUrl, $headers);
     //and invoke the API call request to fetch the response
     //$response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code < 200 || $response->code > 206) {
         //[200,206] = HTTP OK
         return $response;
     }
     return $response->body;
 }