/**
  * Send a message
  * @param  Message     $message     Required parameter: Message Object to send.
  * @return string response from the API call
  * @throws APIException
  **/
 function createMessage($message)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/messages';
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'Flowroute Messaging SDK 1.0', 'content-type' => 'application/json; charset=utf-8');
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, json_encode($message), $this->username, $this->password);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 401) {
         throw new APIException('UNAUTHORIZED', 401, $response->body);
     } else {
         if ($response->code == 403) {
             throw new APIException('FORBIDDEN', 403, $response->body);
         } else {
             if ($response->code < 200 || $response->code > 206) {
                 //[200,206] = HTTP OK
                 throw new APIException("HTTP Response Not OK", $response->code, $response->body);
             }
         }
     }
     return $response->body;
 }
 /**
  * Create an account
  * @param  AccountModel     $account     Required parameter: TODO: type description here
  * @return void response from the API call*/
 public function create($account)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/accounts';
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'content-type' => 'application/json; charset=utf-8', 'X-API-TOKEN' => $this->xAPITOKEN);
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, json_encode($account));
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 403) {
         throw new APIException('User not authorized to perform the operation', 403);
     } else {
         if ($response->code == 404) {
             throw new APIException('Resource not found', 404);
         } else {
             if ($response->code == 400) {
                 throw new APIException('Request could not be understood', 400);
             } else {
                 if ($response->code < 200 || $response->code > 206) {
                     //[200,206] = HTTP OK
                     throw new APIException("HTTP Response Not OK", $response->code);
                 }
             }
         }
     }
 }
 /**
  * Perform a BIN (Bank Identification Number) or IIN (Issuer Identification Number) lookup. See: https://www.neutrinoapi.com/api/bin-lookup/
  * @param  string          $binNumber       Required parameter: The BIN or IIN number (the first 6 digits of a credit card number)
  * @param  string|null     $customerIp      Optional parameter: Pass in a customers remote IP address. The API will then determine the country of the IP address and match it against the BIN country. This feature is designed for fraud prevention and detection checks.
  * @return mixed response from the API call*/
 public function bINLookup($binNumber, $customerIp = NULL)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/bin-lookup';
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare parameters
     $parameters = array('bin-number' => $binNumber, 'output-case' => 'camel', 'customer-ip' => $customerIp);
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //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, $response->body);
     }
     return $response->body;
 }
Example #4
0
 /**
  * Upload a new glossary
  * @param  string     $glossary     Required parameter
  * @param  int        $projectId      Required parameter: Project ID
  * @return mixed response from the API call*/
 public function createGlossary($projectId, $glossary)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/projects/{projectId}/glossaries';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('projectId' => $projectId));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'Authorization' => sprintf('Bearer %1$s', Configuration::$oAuthAccessToken));
     //prepare parameters
     $parameters = array("glossaries[]" => File::add($glossary));
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 400) {
         throw new APIException('FileTooLarge', 400, $response->body);
     } else {
         if ($response->code == 404) {
             throw new APIException('ProjectNotFound', 404, $response->body);
         } else {
             if ($response->code == 405) {
                 throw new APIException('UnsupportedGlossaryFormat', 405, $response->body);
             } else {
                 if ($response->code == 406) {
                     throw new APIException('ProjectAlreadyHasGlossary', 406, $response->body);
                 } else {
                     if ($response->code == 409) {
                         throw new APIException('ProjectAlreadyStarted', 409, $response->body);
                     } else {
                         if ($response->code < 200 || $response->code > 206) {
                             //[200,206] = HTTP OK
                             throw new APIException("HTTP Response Not OK", $response->code, $response->body);
                         }
                     }
                 }
             }
         }
     }
     return $response->body;
 }
Example #5
0
 /**
  * `Sending Mails` – This API is used for sending emails. Pepipost supports REST as well JSON formats for the input. This is JSON API.
  * @param  Emailv1     $data     Required parameter: Data in JSON format
  * @return mixed response from the API call*/
 public function sendJson($data)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/api/web.send.json';
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'content-type' => 'application/json; charset=utf-8');
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, json_encode($data));
     //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, $response->body);
     }
     return $response->body;
 }
 /**
  * TODO: type endpoint description here
  * @return mixed response from the API call*/
 public function createSignupForWalletAccount()
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/api';
     //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::post($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;
 }
 /**
  * Request the generation of a call report for a full month
  * @param  string     $year             Required parameter: The year in YYYY format
  * @param  string     $month            Required parameter: The month in MM format
  * @return mixed response from the API call*/
 public function createCdrsFileRequest($year, $month)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/cdrs/cdrsfile/request/{year}/{month}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('year' => $year, 'month' => $month));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('User-Agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'Content-type' => 'application/json; charset=utf-8');
     //prepare API request
     $request = Unirest::post($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;
 }
Example #8
0
 /**
  * Package the translation project, make it ready to be downloaded.
  * @param  int        $async        Required parameter: If you want to package and download the translation synchronously, mark this parameter as '0'. It will package the translation and then return the packaged file in the response, identical to /download call after an asynchronous /package call.
  * @param  int        $id           Required parameter: Project ID
  * @param  string     $language     Required parameter: Optional language code. If you need, you can package the translation of only a specific language.
  * @return string response from the API call*/
 public function createPackage($id, $language = null, $async = 1)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/projects/{id}/package/{language}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('id' => $id, 'language' => $language));
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($queryBuilder, array('async' => $async));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Authorization' => sprintf('Bearer %1$s', Configuration::$oAuthAccessToken));
     //prepare API request
     $request = Unirest::post($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 == 402) {
         throw new APIException('ProjectNotLaunchedYet', 402, $response->body);
     } else {
         if ($response->code == 404) {
             throw new APIException('TranslationPackageNotFound', 404, $response->body);
         } else {
             if ($response->code < 200 || $response->code > 206) {
                 //[200,206] = HTTP OK
                 throw new APIException("HTTP Response Not OK", $response->code, $response->body);
             }
         }
     }
     return $response->body;
 }
 /**
  * Send a unique security code to any mobile device via SMS. See: https://www.neutrinoapi.com/api/sms-verify/
  * @param  string          $number            Required parameter: The phone number to send a verification code to
  * @param  int|null        $codeLength        Optional parameter: The number of digits to use in the security code (must be between 4 and 12)
  * @param  string|null     $countryCode       Optional parameter: ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)
  * @param  string|null     $languageCode      Optional parameter: The language to send the verification code in, available languages are: de - German, en - English, es - Spanish, fr - Fench, it - Italian, pt - Portuguese, ru - Russian
  * @param  int|null        $securityCode      Optional parameter: ass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random code (only numerical security codes are currently supported)
  * @return mixed response from the API call*/
 public function sMSVerify($number, $codeLength = NULL, $countryCode = NULL, $languageCode = NULL, $securityCode = NULL)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/sms-verify';
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare parameters
     $parameters = array('number' => $number, 'output-case' => 'camel', 'code-length' => null != $codeLength ? $codeLength : 5, 'country-code' => $countryCode, 'language-code' => null != $languageCode ? $languageCode : 'en', 'security-code' => $securityCode);
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //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, $response->body);
     }
     return $response->body;
 }
 /**
  * Watermark one image with another image. See: https://www.neutrinoapi.com/api/image-watermark/
  * @param  string          $imageUrl          Required parameter: The URL to the source image
  * @param  string          $watermarkUrl      Required parameter: The URL to the watermark image
  * @param  string|null     $format            Optional parameter: The output image format, can be either png or jpg
  * @param  int|null        $height            Optional parameter: If set resize the resulting image to this height (preserving aspect ratio)
  * @param  int|null        $opacity           Optional parameter: The opacity of the watermark (0 to 100)
  * @param  string|null     $position          Optional parameter: The position of the watermark image, possible values are: center, top-left, top-center, top-right, bottom-left, bottom-center, bottom-right
  * @param  int|null        $width             Optional parameter: If set resize the resulting image to this width (preserving aspect ratio)
  * @return binary response from the API call*/
 public function imageWatermark($imageUrl, $watermarkUrl, $format = NULL, $height = NULL, $opacity = NULL, $position = NULL, $width = NULL)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/image-watermark';
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0');
     //prepare parameters
     $parameters = array('image-url' => $imageUrl, 'watermark-url' => $watermarkUrl, 'format' => null != $format ? $format : 'png', 'height' => $height, 'opacity' => null != $opacity ? $opacity : 50, 'position' => null != $position ? $position : 'center', 'width' => $width);
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //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, $response->body);
     }
     return $response->body;
 }
 /**
  * Return the sentiment of an English text supplied in an encoded form using key 'text'.
  * @param  string     $text     Required parameter: Supply the text to be classified.
  * @return mixed response from the API call*/
 public function createReturnEnglishGeneralSentimentEncodedForm($text)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/sentiment';
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'X-Mashape-Key' => $this->xMashapeKey);
     //prepare parameters
     $parameters = array('text' => $text);
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //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;
 }
Example #12
0
 /**
  * Submit a comment to an activity.
  * @param  int        $activityId     Required parameter: Activity ID
  * @param  string     $comment        Required parameter: Comment text.
  * @param  int        $projectId      Required parameter: Project ID
  * @return mixed response from the API call*/
 public function submitComment($activityId, $comment, $projectId)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/projects/{projectId}/activities/{activityId}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('activityId' => $activityId, 'projectId' => $projectId));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'Authorization' => sprintf('Bearer %1$s', Configuration::$oAuthAccessToken));
     //prepare parameters
     $parameters = array('comment' => $comment);
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 404) {
         throw new APIException('ProjectActivityNotFound', 404, $response->body);
     } else {
         if ($response->code < 200 || $response->code > 206) {
             //[200,206] = HTTP OK
             throw new APIException("HTTP Response Not OK", $response->code, $response->body);
         }
     }
     return $response->body;
 }
Example #13
0
 /**
  * Create or update your corporate account's global glossary
  * @param $glossary
  * @return mixed
  * @throws APIException
  * @throws \Exception
  */
 public function updateGlossary($glossary)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/glossary';
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'Authorization' => sprintf('Bearer %1$s', Configuration::$oAuthAccessToken));
     //prepare parameters
     $parameters = array("glossary" => File::add($glossary));
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 400) {
         throw new APIException('MissingCorporateAccount | FileTooSmall | FileTooLarge | NoFileUploaded', 400, $response->body);
     } else {
         if ($response->code == 405) {
             throw new APIException('UnsupportedGlossaryFormat', 405, $response->body);
         } else {
             if ($response->code < 200 || $response->code > 206) {
                 //[200,206] = HTTP OK
                 throw new APIException("HTTP Response Not OK", $response->code, $response->body);
             }
         }
     }
     return $response->body;
 }
 /**
  * TODO: type endpoint description here
  * @param  string     $addrs     Required parameter: TODO: type description here
  * @return mixed response from the API call*/
 public function createGetUnspentTransactionOutputsForMultipleAddresses($addrs)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/api/digibyte/api/utxo';
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($queryBuilder, array('addrs' => $addrs));
     //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::post($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;
 }
Example #15
0
 public static function generateAccessToken()
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/token';
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'Authorization' => sprintf('Basic %1$s', base64_encode(Configuration::$clientID . ':' . Configuration::$clientSecret)));
     //prepare parameters
     $parameters = array('grant_type' => 'client_credentials');
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 500) {
         throw new APIException('Authentication error', 500, $response->body);
     } else {
         if ($response->code < 200 || $response->code > 206) {
             //[200,206] = HTTP OK
             throw new APIException("HTTP Response Not OK", $response->code, $response->body);
         }
     }
     if (isset($response->body->error)) {
         throw new APIException($response->body->error->code, $response->body->error->http_code, $response->body->error->message);
     }
     if (!isset($response->body->access_token)) {
         throw new OAuthException('Access token is missing.');
     }
     Configuration::$oAuthAccessToken = $response->body->access_token;
     return $response->body->access_token;
 }
 /**
  * Create a new Access Token.
  * @param  string        $accountNumber         Required parameter: Account Number
  * @param  TokenForm     $accessTokenForm       Required parameter: TODO: type description here
  * @return mixed response from the API call*/
 public function createAccessTokens($accountNumber, $accessTokenForm)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/accounts/{account_number}/access-tokens';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('account_number' => $accountNumber));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'content-type' => 'application/json; charset=utf-8');
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, json_encode($accessTokenForm));
     //append custom auth authorization headers
     CustomAuthUtility::appendCustomAuthParams($request);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 401) {
         throw new APIException('You are not authenticated', 401, $response->body);
     } else {
         if ($response->code == 403) {
             throw new APIException('This action needs a valid WSSE header', 403, $response->body);
         } else {
             if ($response->code == 404) {
                 throw new APIException('Resource not found', 404, $response->body);
             } else {
                 if ($response->code == 400) {
                     throw new APIException('Http bad request', 400, $response->body);
                 } else {
                     if ($response->code < 200 || $response->code > 206) {
                         //[200,206] = HTTP OK
                         throw new APIException("HTTP Response Not OK", $response->code, $response->body);
                     }
                 }
             }
         }
     }
     return $response->body;
 }
 /**
  * Extract HTML tag contents or attributes from complex HTML or XHTML content. See: https://www.neutrinoapi.com/api/html-extract-tags/
  * @param  string          $content         Required parameter: The HTML content. This can be either a URL to load HTML from or an actual HTML content string
  * @param  string          $tag             Required parameter: The HTML tag(s) to extract data from. This can just be a simple tag name like 'img' OR a CSS/jQuery style selector
  * @param  string|null     $attribute       Optional parameter: If set, then extract data from the specified tag attribute. If not set, then data will be extracted from the tags inner content
  * @param  string|null     $baseUrl         Optional parameter: The base URL to replace into realive links
  * @return mixed response from the API call*/
 public function hTMLExtract($content, $tag, $attribute = NULL, $baseUrl = NULL)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/html-extract-tags';
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($queryBuilder, array('user-id' => $this->userId, 'api-key' => $this->apiKey));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare parameters
     $parameters = array('content' => $content, 'output-case' => 'camel', 'tag' => $tag, 'attribute' => $attribute, 'base-url' => $baseUrl);
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, $parameters);
     //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, $response->body);
     }
     return $response->body;
 }