Troubleshooting API Errors
Information you need before contacting Support
- What language are you using?
- Are you using our SDK for that language? (You should. The SDKs are excellent.)
- Using the information below, what is your error?
- Is this an authentication issue?
- Are you receiving an error in the logs? What error?
- Are you receiving unexpected results? What were you expecting and what did you receive?
- If we can't help you with the above information, we're going to need to see code. Pull out the smallest workable code block you can and let us see what you're doing.
- Create an issue on GitHub: https://github.com/UltraCart (create the issue in the proper sdk project).
- Email your script or a small zip file to support@ultracart.com
Examine the Response
Detailed error messages are returned for most API errors within the response body. Â Â
However, clients such as the PHP SDK raise an exception with a very generic message.
For better troubleshooting, fine tune your try/catch blocks to trap the ApiException. Â It yields more information.
Example:
Catching the ApiException
<?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
- Navigate to the API Management page:Â https://secure.ultracart.com/merchant/configuration/apiManagementApp.do
- Click on the log button for your API key.
- View the response and the request.
- Are you sure you're sending what you think you're sending?
- What does the response say? Is it an error? Is it a valid response? If it is valid, are you consuming it properly?