Créer un devis
POST /firms/FIRM_ID/quotes.json
Création d’un nouveau devis. On obtient en retour le code JSON de l’enregistrement créé, avec l’ID qui lui a été attribué.
Un devis doit contenir au moins une ligne de facturation (champs items
)
Le total de chaque ligne de facturation ainsi que le total du devis sont calculés automatiquement et ne doivent pas être transmis.
Requête
curl -i -S -u IdentifiantApi:CleApi -H 'User-Agent: MonApp (patrick@camping.test)' \
-H 'Content-Type: application/json; charset=utf-8' \
-X POST -d '{
"currency": "EUR",
"customer_id": 1,
"invoiced_on": "2013-07-29",
"language": "fr",
"pay_before": "60fm",
"penalty": "0.0",
"title": "Facturation mensuelle",
"items": [{
"position": 1,
"quantity": "1.0",
"title": "Affichage pub 1",
"unit_price": "500",
"vat": "0.200"
}, {
"position": 2,
"quantity": "1.0",
"title": "Affichage pub 2",
"unit_price": "200",
"vat": "0.200"
}]
}' \
"https://www.facturation.pro/firms/FIRM_ID/quotes.json"
Réponse
Status: 201 Created
Location: /firms/FIRM_ID/quotes/411585.json
{
"amount_invoiced": "0.0",
"api_custom": null,
"api_id": null,
"category_id": null,
"currency": "EUR",
"customer_id": 1,
"discount": null,
"draft": false,
"fully_invoiced": false,
"id": 411585,
"ignore_quote": false,
"information": null,
"invoiced_on": "2013-07-29",
"language": "fr",
"pay_before": "60fm",
"penalty": "0.0",
"precompte": null,
"quote_ref": 4,
"quote_status": 0,
"rebate_percentage": "0.0",
"service_personne": false,
"tax_percent": null,
"tax_title": null,
"term_on": "2013-08-28",
"title": "Facturation mensuelle",
"total": "700.0",
"vat_exemption": null,
"items": [
{
"id": 949162,
"nature": 9,
"optional": false,
"position": 1,
"product_id": null,
"quantity": "1.0",
"style": null,
"title": "Affichage pub 1",
"total": "500.0",
"unit_price": "500.0",
"vat": "0.200"
}, {
"id": 949163,
"nature": 9,
"optional": false,
"position": 2,
"product_id": null,
"quantity": "1.0",
"style": null,
"title": "Affichage pub 2",
"total": "200.0",
"unit_price": "200.0",
"vat": "0.200"
}
]
}