1. Home
  2. Knowledge Base
  3. API
  4. Checking For a Successful Request

Checking For a Successful Request

An API request can either by successful or not. The best way to explain how to check for this is through code so let's go through it.

<?php
$response = $api->get('/levels');
$response = unserialize($response);
if($response['success']==1){
echo 'Request successful';
// do stuff here
} else {
echo 'Request failed';
echo '<br />';
echo 'Error Code:' . $response['ERROR_CODE'];
echo '<br />';
echo 'Error Description:' . $response['ERROR'];
}
?>
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support