API - Documentation

Connexion à l'API


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; }
}
?>

Commandes


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. - {
    Success : true,
    ErrorMessage : null,
    Data : [
        Credits : @Int
    ]
}
0
GenerateDocument Génère un document (Devis, Facture ou Avoir) avec toutes les informations (sans le valider). <?php $OPTIONS = [
    
'typeDocument' => 'INVOICE'// TYPE DU DOCUMENT (Obligatoire) | "INVOICE" : FACTURE , "QUOTATION" : DEVIS", "CREDIT" : AVOIR
    
'numberDocument' => 'F3478'// NUMERO DU DOCUMENT (Facultatif)
    
'customText1' => '...'// TEXTE PERSONNALISÉ 1 (Facultatif)
    
'customText2' => '...'// TEXTE PERSONNALISÉ 2 (Facultatif)
    
'lines' => [
        [
            
'REFERENCE' => '90248',                 // REFERENCE (Facultatif)
            
'TITLE' => "Main d'oeuvre peinture",    // DESCRIPTION / LIBELLE (Facultatif)
            
'PRICE_UNIT' => 34.95,                  // PRIX UNITAIRE (Facultatif)
            
'QUANTITY' => 12,                       // QUANTITÉ (Facultatif)
            
'DISCOUNT' => 10,                       // REMISE (%) (Facultatif)
            
'VAT' => 20,                            // TVA (%) (Facultatif)
            
'TYPE' => 1                             // 1 => PRESTATION DE SERVICE | 2 => VENTE DE MARCHANDISE (Facultatif)
        
],
        [
            
'TITLE' => 'Pot de peinture 5 Litres',
            
'PRICE_UNIT' => 49.99,
            
'QUANTITY' => 3,
            
'TYPE' => 2,
            
'VAT' => 20,
            
'REFERENCE' => 'PEINT-NOIR-039'
        
],
        [
            
'TITLE' => 'Ligne vide'
        
]
    ],
    
'customerID' => 23,    // ID DU CLIENT (Facultatif)
    
'finalizeDocument' => false,  // FINALISER LE DOCUMENT (Facultatif) - Par défaut : false
    
'sendToCustomer' => false  // ENVOYER LE DOCUMENT AU CLIENT (Facultatif) - Par défaut : false - Si finalizeDocument = true
]; ?>
{
    Success : true,
    ErrorMessage : null,
    Data : [
        UrlDocument : @String
        ID : @int
    ]
}
3
CreateCustomer Création d'un fichier client <?php $OPTIONS = array(
'firstName' => 'PRENOM',            /* OBLIGATOIRE POUR LES CLIENTS PARTICULIERS */
'lastName' => 'NOM',                /* OBLIGATOIRE POUR LES CLIENTS PARTICULIERS */
'companyName' => 'NOM ENTREPRISE',  /* OBLIGATOIRE POUR LES CLIENTS PROFESSIONNELS */
'companySiret' => 'NUMERO SIRET',   /* OBLIGATOIRE POUR LES CLIENTS PROFESSIONNELS */
'mail' => 'ADRESSE E-MAIL',         /* FACULTATIF */
'phone' => 'TELEPHONE',             /* FACULTATIF */
'adress' => 'ADRESSE',              /* FACULTATIF */
'zip' => 'CODE POSTAL',             /* FACULTATIF */
'city' => 'VILLE',                  /* FACULTATIF */
'country' => 'PAYS',                /* FACULTATIF */
'typeCustomer' => 1,                  /* 1 => CLIENT PARTICULIER | 2 => CLIENT PROFESSIONNEL */
'tvaNumber' => 'FR20984982492'
); ?>
{
    Success : true,
    ErrorMessage : null,
    Data : [
        ID_Customer : @int (ID du client)
]}
1
DeleteCustomer Supprime un client grâce à son ID (Identifiant unique). <?php $OPTIONS /* ID DU CLIENT */ ?> {
    Success : true,
    ErrorMessage : null,
    Data : null
}
1
GetDocumentPDF Récupère l'URL du fichier PDF associé à un document. <?php $OPTIONS /* ID DU DOCUMENT */ ?> {
    Success : true,
    ErrorMessage : null,
    Data : [
        URL : @string
]}
1