ERPNext – Interface REST API

Contrairement à ODOO qui ne le propose pas nativement, ERPNext étant conçu avec pour son interface Frontend-Backend, est totalement interfaçable en API REST.

Nous verrons ultérieurement que cela permet à ERPNext d'être facilement intégrable à d'autres solutions (Google, Magento, Prestashop, WooCommerce, Shopify, Dropbox, Paypal, Hubspot ...) soit en direct, soit via des middlewares d'intégration (Pentaho Data Intégration, Myddleware, Zapier, Piesync ...).

Voici quelques exemples d'appel REST via curl :

curl -X POST http://votre_erpnext.fr/api/method/login \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"usr":"Administrator","pwd":"xxxxx"}' -c frappe.cookie
>>> réponse :
{"message":"Logged In","home_page":"/desk","full_name":"Administrator"}

curl -X GET http://votre_erpnext.fr/api/resource/Lead -b frappe.cookie
>>> réponse :
{"data":[{"name":"CRM-LEAD-2020-00001"}]}


curl -X GET http://votre_erpnext.fr/api/resource/Lead/CRM-LEAD-2020-00001 -b frappe.cookie
>>> réponse :
{"data":{"name":"CRM-LEAD-2020-00001","owner":"Administrator","creation":"2020-06-15 10:41:22.534988","modified":"2020-06-15 10:41:22.534988","modified_by":"Administrator","idx":0,"docstatus":0,"organization_lead":0,"naming_series":"CRM-LEAD-.YYYY.-","lead_name":"prospect1","lead_owner":"Administrator","status":"Lead","territory":"Tous les Territoires","type":"","request_type":"","company":"AgiPME","unsubscribed":0,"blog_subscriber":0,"doctype":"Lead"}}


curl -X POST http://votre_erpnext.fr/api/resource/Lead \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"lead_name":"Prospect1"}' -b frappe.cookie
>>> réponse :
{"data":{"name":"CRM-LEAD-2020-00002","owner":"Administrator","creation":"2020-06-15 10:44:02.752566","modified":"2020-06-15 10:44:02.752566","modified_by":"Administrator","parent":null,"parentfield":null,"parenttype":null,"idx":0,"docstatus":0,"organization_lead":0,"naming_series":"CRM-LEAD-.YYYY.-","lead_name":"Prospect1","company_name":null,"email_id":null,"lead_owner":"Administrator","status":"Lead","gender":null,"source":null,"customer":null,"campaign_name":null,"image":null,"contact_by":null,"contact_date":null,"ends_on":null,"notes":null,"phone":null,"salutation":null,"mobile_no":null,"fax":null,"website":null,"territory":"Tous les Territoires","type":"","market_segment":null,"industry":null,"request_type":"","company":"AgiPME","unsubscribed":0,"blog_subscriber":0,"doctype":"Lead"}


curl -X GET http://votre_erpnext.fr/api/method/logout -c frappe.cookie
>>> réponse :
{}

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *