step 1. Install python 2.7 in your system (Windows,Ubuntu,MAC)
step 2. Download and install easy install for Python (Windows,Ubuntu,MAC)
step 3. To install python requests module(library) open command prompt/terminal and type >easy_install requests
step 4. Clone/Download erpnext_rest_api
Let us assume that we want to get the list of Item
(doctype) in ERPNext
- In command prompt/terminal and navigate to the downloaded erpnext_rest_api folder
>python get_doc_list.py Item
- Response
{"data": [{"name":"Kitchen rack"}, {"name":"Iron rods"}, {"name":"Book rack"},{"name":"Plywood"}] }
Let us assume that we want to get the information of an Item
Plywood
in ERPNext
- In command prompt/terminal and navigate to the downloaded erpnext_rest_api folder
>python get_doc_info.py Item Plywood
- Response
{"data": {"name":"Plywood", "doctype":"Item", "last_purchase_rate":10.0, ...... ...... } }
Let us assume that we want to create new address in ERPNext
- In command prompt/terminal and navigate to the downloaded erpnext_rest_api folder
>python post_to_doc.py
- Response
{"data": {"creation":"2014-07-13 22:04:35.098221", "doctype":"Address", "phone":"012345678", "owner":"Administrator", "city":"BangLORE", "address_line1":"Vijayanagar", "modified_by":"Administrator", "address_title":"Mr.Machha", "name":"Mr.GuruMachha-Billing", "country":"India", ...... ...... } }
- By this you created new address in your ERPNext
- To create new element, open
post_to_doc.py
in any editor and declare data as a dictionary like above and modify as you want - Make sure to include mandatory fields in data