Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Examine the Response

Detailed error messages are returned for most API errors within the response body.    

...

Code Block
languagephp
titleCatching the ApiException
linenumberstrue
<?php
require_once(__DIR__ . '/SwaggerClient-php/autoload.php');

ultracart\v2\Configuration::getDefaultConfiguration()->setApiKey('x-ultracart-simple-key', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

$api_instance = new ultracart\v2\api\CustomerApi();
$customer_profile_oid = 1234567; // int | The customer oid to retrieve.

try {
    $result = $api_instance->customerCustomersCustomerProfileOidGet($customer_profile_oid);
    print_r($result);
} catch (\ultracart\v2\ApiException $e) {
    echo 'Exception when calling CustomerApi->customerCustomersCustomerProfileOidGet: ', $e->getMessage(), PHP_EOL;
    // THE FOLLOWING LINE PROVIDES DETAILED ERROR INFORMATION
    print_r($e->getResponseObject());
}


Read the Logs

Image Added

  • View the response and the request.
    1. Are you sure you're sending what you think you're sending?
    2. What does the response say?  Is it an error?  Is it a valid response?  If it is valid, are you consuming it properly?


Image Added