Data can be retrieved using the GET method. This is the technique you also use when you simply pass a URL in a web browser.


So, for example, you can specify https://app.simplybooks.be/api/v1/clients in a web browser to get a list in XML of all customers. Another example: https://app.simplybooks.be/api/v1/invoices/1001/payments. Which returns a list of all payments of invoice with ID 1001.


As mentioned earlier, you can adjust the format in which the obtained data is returned. To do this, add the extension, for example, '?format=json' to the URL. The possible formats are xml, json, csv and html.


An example in PHP how to retrieve data:

$email = 'luc@mymail.com';
$password = '123456';
 
$p = curl_init('https://eenvoudigfactureren.be/api/v1/clients');
curl_setopt($p, CURLOPT_USERPWD, $email . ':' . $password);
curl_setopt($p, CURLOPT_RETURNTRANSFER, TRUE);
$xml_string_all_clients = curl_exec($p);


If you enter a wrong URL because, for example, the requested customer does not exist, you will also receive an XML (or the requested format) with the reason for the error.


For example, if you request the data for the non-existent customer with ID 1001 with URL https://app.simplybooks.be/api/v1/clients/1001 you will get:

<data>
  <error>client_id unknown</error>
</data>


  More info about the API? Read the useful articles below