code

VosFactures API

Grâce à l'API, le logiciel de facturation en ligne est facilement intégrable avec d'autres applications externes (ex: site internet) pour une création automatique de factures et autres documents de facturation - qui peuvent même être envoyées directement par email.

Ci-dessous, nous illustrons des demandes faites avec cURL, qui peut être remplacé par tout autre langage informatique.

Les demandes sont compatibles avec JSON (en changeant le suffixe xml en json) et SSL (en changeant HTTP en HTTPS).

La documentation complète est disponible sur Github: https://github.com/vosfactures/API

Code API

Le code API (API_TOKEN) de votre compte VosFactures (YOUR_DOMAIN) est affiché dans les paramètres du compte (Paramètres -> Paramètres du compte -> Intégration -> Code d'autorisation API)


Factures

Télécharger les factures selon une période choisie

Sélectionner les factures du mois en cours:

XML
curl https://YOUR_DOMAIN.vosfactures.fr/invoices.xml?period=this_month&api_token=API_TOKEN"

JSON
curl https://YOUR_DOMAIN.vosfactures.fr/invoices.json?period=this_month&api_token=API_TOKEN"

Des paramètres additionnels peuvent être transmis aux appels, ex: page=, period= etc... (Vous pouvez utiliser les mêmes filtres que ceux du moteur de recherche utilisé pour afficher la liste des documents dans le logiciel).

Sélectionner une facture par numéro d'ID

XML
curl "https://YOUR_DOMAIN.vosfactures.fr/invoices/100.xml?api_token=API_TOKEN"

JSON
curl https://YOUR_DOMAIN.vosfactures.fr/invoices/100.json?api_token=API_TOKEN"

Sélectionner une facture par numéro de commande

XML
curl "https://YOUR_DOMAIN.vosfactures.fr/invoices.xml?oid=nr_zam&api_token=API_TOKEN"

JSON
curl "https://YOUR_DOMAIN.vosfactures.fr/invoices.json?oid=nr_zam&api_token=API_TOKEN"

Ajouter une nouvelle facture

JSON (recommandé)

cURL

JSON
curl https: //YOUR_DOMAIN.vosfactures.fr/invoices.json -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{ "api_token": "API_TOKEN", "invoice": { "kind": "vat", "number": null, "sell_date": "2013-01-16", "issue_date": "2013-01-16", "payment_to": "2013-01-23", "seller_name": "Société Chose", "seller_tax_no": "FR5252445767", "buyer_name": "Client Intel", "buyer_tax_no": "FR45362780010", "positions": [ { "name": "Produit A1", "tax": 23, "total_price_gross": 10.23, "quantity": 1 }, { "name": "Produit A2", "tax": 0, "total_price_gross": 50, "quantity": 3 } ] } }'

Ruby

JSON
endpoint = 'http://your_domain.vosfactures.fr/invoices.json' uri = URI.parse(endpoint) json_params = { "api_token" => "API_TOKEN", "invoice" => { "kind" =>"vat", "number" => nil, "sell_date" => "2013-02-07", "issue_date" => "2013-02-07", "payment_to" => "2013-02-14", "seller_name" => "Société Chose", "seller_tax_no" => "FR5252445767", "buyer_name" => "Client Intel", "buyer_tax_no" => "FR45362780010", "positions" =>[ { "name" =>"Produit A1", "tax" =>23, "total_price_gross" =>10.23, "quantity" =>1 }, { "name" =>"Produit A2", "tax" =>0, "total_price_gross" =>50, "quantity" =>3 } ] } } request = Net::HTTP::Post.new(uri.path) request.body = JSON.generate(json_params) request["Content-Type"] = "application/json" http = Net::HTTP.new(uri.host, uri.port) response = http.start {|h| h.request(request)} if response.code == '201' ret = JSON.parse(response.body) else ret = response.body end puts ret.to_json

Selon un certain client (client_id) et un département vendeur(department_id):

XML
curl http: //YOUR_DOMAIN.vosfactures.fr/invoices.xml -u 'login:YOUR_PASSWORD -H 'Accept: application/xml' -H 'Content-Type: application/xml' -d ' vat 2013-02-07 2013-02-07 2013-02-14 Société Chose FR45362780010 Client Intel FR45362780010 Produit A1 23 20 1 Produit A2 0 10 3 '

JSON
curl http: //YOUR_DOMAIN.vosfactures.fr/invoices.json -u 'login:YOUR_PASSWORD -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{ "api_token": "API_TOKEN", "invoice": { "kind": "vat", "number": null, "sell_date": "2013-02-07", "issue_date": "2013-02-07", "payment_to": "2013-02-14", "department_id": 1, "client_id": 2, "buyer_name": "Client Intel", "buyer_tax_no": "FR45362780010", "positions": [ { "name": "Produit A&", "tax": 23, "total_price_gross": 10.23, "quantity": 1 }, { "name": "Produit A2", "tax": 0, "total_price_gross": 50, "quantity": 3 } ] } }'

Supprimer une facture

XML
curl -X DELETE "https://YOUR_DOMAIN.vosfactures.fr/invoices/100.xml?api_token=API_TOKEN"

JSON
curl -X DELETE "curl -X DELETE "https://YOUR_DOMAIN.vosfactures.fr/invoices/100.json?api_token=API_TOKEN"


Produits

Liste des Produits

XML
curl "https://YOUR_DOMAIN.vosfactures.fr/products.xml?api_token=API_TOKEN&page=1"

Sélectionner un produit selon son ID

XML
curl "https://YOUR_DOMAIN.vosfactures.fr/products/100.xml?api_token=API_TOKEN"

Formulaire de paiement (Fonction E-commerce)

Pour télécharger le formulaire de paiements (sous la forme JS), appeler l'URL:

http://app.vosfactures.fr/a/YOUR_DOMAIN/p/{{token}}.js

où {{token}} est le code d'identification du produit.


Clients

Liste des clients

XML
curl "https://YOUR_DOMAIN.vosfactures.fr/clients.xml?api_token=API_TOKEN&page=1"

Sélectionner un client par son ID

XML curl "https://YOUR_DOMAIN.vosfactures.fr/clients/100.xml?api_token=API_TOKEN"


Paiements

Liste des paiements

XML
curl "https://YOUR_DOMAIN.vosfactures.fr/payments.xml?api_token=API_TOKEN"

JSON
curl "https://YOUR_DOMAIN.vosfactures.fr/payments.json?api_token=API_TOKEN"

Selectionner un paiement par ID

XML
curl "https://YOUR_DOMAIN.vosfactures.fr/payments/100.xml?api_token=API_TOKEN"

JSON
curl "https://YOUR_DOMAIN.vosfactures.fr/payments/100.json?api_token=API_TOKEN"

Ajouter un nouveau paiement

JSON (recommandé)
curl https: //YOUR_DOMAIN.vosfactures.fr/payments.json -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{ "api_token": "API_TOKEN", "payment": { "city": null, "client_id": null, "comment": null, "country": null, "currency": "EUR", "deleted": false, "department_id": null, "description": "abonnement", "email": "email@email.fr", "first_name": "Jean", "generate_invoice": true, "invoice_city": "France", "invoice_comment": "", "invoice_country": null, "invoice_id": null, "invoice_name": "Compagnie intel", "invoice_post_code": "06000", "invoice_street": "52 rue des Oranges", "invoice_tax_no": "FR52524457", "last_name": "Valjean", "name": "Paiement pour le produit A1", "oid": "", "paid": true, "paid_date": null, "phone": null, "post_code": null, "price": "100.00", "product_id": 1, "promocode": "", "provider": "transfer", "provider_response": null, "provider_status": null, "provider_title": null, "quantity": 1, "street": null, "kind": "api" } }'