BaseController::USER_AGENT, 'content-type' => 'application/json; charset=utf-8', 'api_key' => Configuration::$apiKey ); //json encode body $_bodyJson = Request\Body::Json($body); //call on-before Http callback $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response $response = Request::post($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); //call on-after Http callback if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } //Error handling using HTTP status codes if ($response->code == 400) { throw new APIException('API Response', $_httpContext); } if ($response->code == 401) { throw new APIException('API Response', $_httpContext); } if ($response->code == 403) { throw new APIException('API Response', $_httpContext); } if ($response->code == 405) { throw new APIException('Invalid input', $_httpContext); } //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); return $response->body; } /** * Use this API to remove an email address or a recipient domain from the suppression list. You can * remove multiple email addresses and recipient domains together by passing them as values & * separating them using commas as shown below. * * @param Models\RemoveemailordomaintoSuppressionlist $body remove email or domain to suppression list * @return object response from the API call * @throws APIException Thrown if API call fails */ public function removedomainoremailtosuppressionlist( $body ) { //prepare query string for API call $_queryBuilder = '/suppression'; //validate and preprocess url $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'content-type' => 'application/json; charset=utf-8', 'api_key' => Configuration::$apiKey ); //json encode body $_bodyJson = Request\Body::Json($body); //call on-before Http callback $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); } //and invoke the API call request to fetch the response $response = Request::delete($_queryUrl, $_headers, $_bodyJson); $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); $_httpContext = new HttpContext($_httpRequest, $_httpResponse); //call on-after Http callback if ($this->getHttpCallBack() != null) { $this->getHttpCallBack()->callOnAfterRequest($_httpContext); } //Error handling using HTTP status codes if ($response->code == 400) { throw new APIException('API Response', $_httpContext); } if ($response->code == 401) { throw new APIException('API Response', $_httpContext); } if ($response->code == 403) { throw new APIException('API Response', $_httpContext); } if ($response->code == 405) { throw new APIException('Invalid input', $_httpContext); } //handle errors defined at the API level $this->validateResponse($_httpResponse, $_httpContext); return $response->body; } }