Skip to content

Check for API Error Codes

donclem edited this page Jul 6, 2012 · 2 revisions

When making various calls in the PHP API Client, you may want to check for any error codes that may come up (due to various handling issues). The documented Error Codes are available here.

Example

 $resultscheck = $api->GetListings();
 if ($resultcheck === false) {
      echo "API Error Code: {$api->last_error_code}<br>\n";
      echo "API Error Message: {$api->last_error_mess}<br>\n";
      exit;
 } else {
      // enter outcome here if successful call (for example print_r($resultscheck);)
 }

Spark Platform Documentation

Spark Platform Error Codes