/** * Delete an address from your account * @param int $addressId Required parameter: The identifier of the address * @return mixed response from the API call*/ public function deleteAddress($addressId) { //the base uri for api requests $queryBuilder = Configuration::BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/regulation/address/{addressId}'; //process optional query parameters APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('addressId' => $addressId)); //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::delete($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; }
/** * Delete an access token * @param string $accountNumber Required parameter: Account Number * @param string $token Required parameter: Token * @return string response from the API call*/ public function deleteAccessToken($accountNumber, $token) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/accounts/{account_number}/access-tokens/{token}'; //process optional query parameters APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('account_number' => $accountNumber, 'token' => $token)); //validate and preprocess url $queryUrl = APIHelper::cleanUrl($queryBuilder); //prepare headers $headers = array('user-agent' => 'APIMATIC 2.0'); //prepare API request $request = Unirest::delete($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; }
/** * Delete the style guide * @param int $projectId Required parameter: Project ID * @param int $styleGuideId Required parameter: Style Guide ID * @return mixed response from the API call*/ public function deleteStyleGuide($projectId, $styleGuideId) { //the base uri for api requests $queryBuilder = Configuration::$BASEURI; //prepare query string for API call $queryBuilder = $queryBuilder . '/projects/{projectId}/styleguides/{styleGuideId}'; //process optional query parameters APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('projectId' => $projectId, 'styleGuideId' => $styleGuideId)); //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::delete($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('StyleGuideNotFound', 404, $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; }