/** * Allow clients to test authentication. * @return mixed response from the API call*/ public function getAuthentications() { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/authentications'; //validate and preprocess url $queryUrl = APIHelper::cleanUrl($queryBuilder); //prepare headers $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'X-API-TOKEN' => $this->xAPITOKEN); //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 == 403) { throw new APIException('User not authorized to perform the operation', 403); } else { if ($response->code < 200 || $response->code > 206) { //[200,206] = HTTP OK throw new APIException("HTTP Response Not OK", $response->code); } } return $response->body; }
/** * TODO: type endpoint description here * @return mixed response from the API call*/ public function getAccount() { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/me'; //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 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 == 404) { throw new APIException('UserNotFound', 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; }
/** * Allow clients to test authentication. * @return mixed response from the API call*/ public function getAuthentications() { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/authentications'; //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); //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 == 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; }
/** * TODO: type endpoint description here * @return mixed response from the API call*/ public function getStatsForSpecifiedChain() { //the base uri for api requests $queryBuilder = Configuration::BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/api/ethereum/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::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; }
/** * `Sending Mails` – This API is used for sending emails. Pepipost supports REST as well JSON formats for the input * @param string $apiKey Required parameter: Your API Key * @param string $content Required parameter: Email body in html (to use attributes to display dynamic values such as name, account number, etc. for ex. [% NAME %] for ATT_NAME , [% AGE %] for ATT_AGE etc.) * @param string $from Required parameter: From email address * @param string $recipients Required parameter: Email addresses for recipients (multiple values allowed) * @param string $subject Required parameter: Subject of the Email * @param string|null $aTTNAME Optional parameter: Specify attributes followed by ATT_ for recipient to personalized email for ex. ATT_NAME for name, ATT_AGE for age etc. (Multiple attributes are allowed) * @param string|null $attachmentid Optional parameter: specify uploaded attachments id (Multiple attachments are allowed) * @param string|null $bcc Optional parameter: Email address for bcc * @param bool|null $clicktrack Optional parameter: set ‘0’ or ‘1’ in-order to disable or enable the click-track * @param bool|null $footer Optional parameter: Set '0' or '1' in order to include footer or not * @param string|null $fromname Optional parameter: Email Sender name * @param bool|null $opentrack Optional parameter: set open-track value to ‘0’ or ‘1’ in-order to disable or enable * @param string|null $replytoid Optional parameter: Reply to email address * @param string|null $tags Optional parameter: To relate each message. Useful for reports. * @param int|null $template Optional parameter: Email template ID * @param string|null $xAPIHEADER Optional parameter: Your defined unique identifier * @return mixed response from the API call*/ public function sendRest($apiKey, $content, $from, $recipients, $subject, $aTTNAME = NULL, $attachmentid = NULL, $bcc = NULL, $clicktrack = NULL, $footer = NULL, $fromname = NULL, $opentrack = NULL, $replytoid = NULL, $tags = NULL, $template = NULL, $xAPIHEADER = NULL) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/api/web.send.rest'; //process optional query parameters APIHelper::appendUrlWithQueryParameters($queryBuilder, array('api_key' => $apiKey, 'content' => $content, 'from' => $from, 'recipients' => $recipients, 'subject' => $subject, 'ATT_NAME' => $aTTNAME, 'attachmentid' => $attachmentid, 'bcc' => $bcc, 'clicktrack' => null != $clicktrack ? var_export($clicktrack, true) : true, 'footer' => null != $footer ? var_export($footer, true) : true, 'fromname' => $fromname, 'opentrack' => null != $opentrack ? var_export($opentrack, true) : true, 'replytoid' => $replytoid, 'tags' => $tags, 'template' => $template, 'X-APIHEADER' => $xAPIHEADER)); //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, $response->body); } return $response->body; }
/** * 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; }
/** * 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; }
/** * TODO: type endpoint description here * @param string $addresses Required parameter: TODO: type description here * @return mixed response from the API call*/ public function getUnspentTransactionOutputsForMultipleAddresses($addresses) { //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('addresses' => $addresses)); //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; }
/** * Download the latest translation package. If a language is provided, only the translation package of that language is returned. You must have given a /package call beforehand and wait until the packaging status is 'completed'. * @param int $id Required parameter: Project ID * @param string $language Required parameter: Optional language code. If you need, you can download the translation of only a specific language. * @return string response from the API call*/ public function download($id, $language = null) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/projects/{id}/download/{language}'; //process optional query parameters APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('id' => $id, 'language' => $language)); //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::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 == 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; }
/** * Allow clients to get a specific region for a specific country * @param string $countryIso2 Required parameter: Country ISO2 * @param string $regionHandle Required parameter: Region handle * @return mixed response from the API call*/ public function getRegionsByHandle($countryIso2, $regionHandle) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/dids/location/countries/{country_iso2}/regions/{region_handle}'; //process optional query parameters APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('country_iso2' => $countryIso2, 'region_handle' => $regionHandle)); //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); //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; }
/** * Get a list of comments belonging to this activity. * @param int $activityId Required parameter: Activity ID * @param int $projectId Required parameter: Project ID * @return mixed response from the API call*/ public function getActivityComments($activityId, $projectId) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/projects/{projectId}/activities/{activityId}/comments'; //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 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 == 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; }
/** * Lookup a Message by MDR * @param string $recordId Required parameter: Unique MDR ID * @return string response from the API call * @throws APIException **/ function getMessageLookup($recordId) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/messages/{record_id}'; //process optional query parameters APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('record_id' => $recordId)); //validate and preprocess url $queryUrl = APIHelper::cleanUrl($queryBuilder); //prepare headers $headers = array('user-agent' => 'Flowroute Messaging SDK 1.0'); //prepare API request $request = Unirest::get($queryUrl, $headers, NULL, $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 < 200 || $response->code > 206) { //[200,206] = HTTP OK throw new APIException("HTTP Response Not OK", $response->code, $response->body); } return $response->body; }