You are here

function cc::http_get_response_code_error in Constant Contact 6.2

Same name and namespace in other branches
  1. 6.3 class.cc.php \cc::http_get_response_code_error()
  2. 7.3 class.cc.php \cc::http_get_response_code_error()

* Returns a friendly error message for the given HTTP status error code * This can be used to better understand a status code returned by the API * * * @access private

File

./class.cc.php, line 1977

Class

cc
@file

Code

function http_get_response_code_error($code) {
  $errors = array(
    200 => 'Success - The request was successful',
    201 => 'Created (Success) - The request was successful. The requested object/resource was created.',
    400 => 'Invalid Request - There are many possible causes for this error, but most commonly there is a problem with the structure or content of XML your application provided. Carefully review your XML. One simple test approach is to perform a GET on a URI and use the GET response as an input to a PUT for the same resource. With minor modifications, the input can be used for a POST as well.',
    401 => 'Unauthorized - This is an authentication problem. Primary reason is that the API call has either not provided a valid API Key, Account Owner Name and Associated Password or the API call attempted to access a resource (URI) which does not match the same as the Account Owner provided in the login credientials.',
    404 => 'URL Not Found - The URI which was provided was incorrect. Compare the URI you provided with the documented URIs. Start here.',
    409 => 'Conflict - There is a problem with the action you are trying to perform. Commonly, you are trying to "Create" (POST) a resource which already exists such as a Contact List or Email Address that already exists. In general, if a resource already exists, an application can "Update" the resource with a "PUT" request for that resource.',
    415 => 'Unsupported Media Type - The Media Type (Content Type) of the data you are sending does not match the expected Content Type for the specific action you are performing on the specific Resource you are acting on. Often this is due to an error in the content-type you define for your HTTP invocation (GET, PUT, POST). You will also get this error message if you are invoking a method (PUT, POST, DELETE) which is not supported for the Resource (URI) you are referencing.
		To understand which methods are supported for each resource, and which content-type is expected, see the documentation for that Resource.',
    500 => 'Server Error',
  );
  if (array_key_exists($error, $errors)) {
    return $errors[$error];
  }
  return '';
}