getCreditstate

Returns the current state of your credit data.

Route /user/getCreditstate[/:key[/:format]]
Necessary parameter
Optional parameter format
Return values creditamount
additionalCreditamount
bookedCreditamount
refillintervall
lastrefill
creditsleft
creditsused
Cross references
Hints

Parameters

Labeling Description Values margin Default value
format Defines in which format the result will be returned. json|xml json

Return values

Labeling Description Values margin
creditamount
Shows the monthly available credit amount. (0-9)+
additinalCreditamount Shows the additional credit amount. (0-9)+
bookedCreditamount Shows the additional requested credit amount. (0-9)+
refillintervall Shows the interval of reinstatement for your credits. 1
lastrefill Shows the date of the last reinstatement of your credits. (0-9){4}-(0-9){2}-(0-9){2}
creditsleft Contains the credits left till next reinstatement. (0-9)+
creditsused Contains the amount of credits being charged since the last reinstatement. (0-9)

Messages

Message Description
internal error An internal error occured.
param missing A required parameter is missing.
param invalid The value of a parameter is not valid.
result empty The request was successful, but the result itself is empty.
cost error The current credit amount is not sufficient to handle the request.
0k. The processing was successful.

Exemplary code

  $root = 'https://suite.xovi.net/api/';

 $arrayParams = array(
 'service' =>'user',
 'method' =>'getCreditstate',
 'key' =>'myPersonalKey',
 'format' =>'json',
 );

$GETparams = implode('/', $arrayParams);

$requestURL = $root.$GETparams;

if (!function_exists('curl_init')) die('cURL not available');

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_URL, $requestURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Download the given URL, and return output
$output = curl_exec($ch);

// Close the cURL resource, and free system resources
curl_close($ch);

echo $output;
?>

Exemplary results

JSON

{
 "apiErrorCode":0,
 "apiErrorMessage":"0k.",
 "apiResult":{
     "creditamount":1000,
     "additionalCreditamount":5000,
     "bookedCreditamount":1000,
     "refillintervall":4,
     "lastrefill":"2013-03-08 15:00:00",
     "creditsleft":5280,
     "creditsused":720
 }
}

XML

<?xml version="1.0"?>
<result>
    <apiErrorCode>0</apiErrorCode>
    <apiErrorMessage>0k.</apiErrorMessage>
    <apiResult>
        <creditstates>
            <creditstate>
                <creditamount>1000</creditamount>
                <additionalCreditamount>5000</additionalCreditamount>
                <bookedCreditamount>1000</bookedCreditamount>
                <refillintervall>4</refillintervall>
                <lastrefill>2013-03-08 15:00:00</lastrefill>
                <creditsleft>5280</creditsleft>
                <creditsused>720</creditsused>
            </creditstate>
        </creditstates>
    </apiResult>
</result>