La connexion à l'API se fait grâce aux deux jetons (Token) privés accessible dans votre espace membre.
(Rubrique
Mon compte, puis API*).
* Vos clés API ne s'afficheront que si vous êtes abonné à l'offre PRO
Connexion grâce à cURL (PHP)
<?php
// CONFIGURATION
$TOKEN_USER = /* INSERT YOUR TOKEN_USER HERE */;
$TOKEN_SECRET = /* INSERT YOUR TOKEN_SECRET HERE */;
$COMMAND = "GetCredits";
$OPTIONS = array();
// END CONFIGURATION
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.kolirys.fr/api/$TOKEN_USER/$TOKEN_SECRET/$COMMAND",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['options' => json_encode($OPTIONS)]),
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_HTTPHEADER => array('Content-Type: application/json')
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) { return "cURL Error #:" . $err; } else { $objectResponse = json_decode($response);
if ($objectResponse->Success) { return "LOG SUCCESS"; }
else { return $objectResponse->ErrorMessage; }
}
?>
Les différentes commandes peuvent être exécutées via la variable $COMMAND. Une commande peut consommer des Crédits sur votre compte. Voici la liste complète:
Nom de la commande | Description | Options | Retour | Crédits / requête |
---|---|---|---|---|
GetCredits | Permet de récupérer le nombre de crédits restants. | - |
{ |
0 |
GenerateDocument | Génère un document (Devis, Facture ou Avoir) avec toutes les informations (sans le valider). |
<?php $OPTIONS = [ |
{ |
3 |
CreateCustomer | Création d'un fichier client |
<?php $OPTIONS = array( |
{ |
1 |
DeleteCustomer | Supprime un client grâce à son ID (Identifiant unique). |
<?php $OPTIONS = /* ID DU CLIENT */ ?>
|
{ |
1 |
GetDocumentPDF | Récupère l'URL du fichier PDF associé à un document. |
<?php $OPTIONS = /* ID DU DOCUMENT */ ?>
|
{ |
1 |