Hello,
I am in the process of developing an android app and my app has to create a stock entry in the Stock Entry table(which has links to other tables like Stock Entry detail etc) for a read bar code (which is got from a scanner app on my android device) and is equivalent a Serial no in ERPNext .
Now I am unable to use a simple POST request Restful API like this(as per documentation)
POST http://frappe.local:8000/api/resource/Stock Entry
Since this was a bit complicated, I thought I’ll write an API method and then call that method using GET from my android app while passing the read bar code/serial number as a parameter.
To write this custom API method, I followed these steps
- frappe-bench$ bench get-app renfield https://github.com/umaepoch/renfield
2)frappe-bench$ bench –site inventory install-app renfield
- frappe-bench$ bench –site inventory migrate
So now, I created an api.py file in this folder
frappe-bench/apps/renfield/renfield/api.py
Now in the api.py file I have this white listed method that takes a serial_no string and creates a stock entry and all other entries.
@frappe.whitelist()(allow_guest=True)
def make_stock_entry(serial_no):
###code here to update stock entry and related tables
before testing it on Android, I used Postman to check if the method call works, so I did this
GET http://192.168.1.4:8000/api/method/renfield.api.make_stock_entry?serial_no=8906001055891
All that I get a error message saying Invalid Method
What am I doing wrong and where should I put my white listed method so that I can make a RPC call like?
GET http://server:8000/api/method/{name_of_method with arguments}
Please note I am successfully able to query the table, list the entries etc with the ReST APIs
Pragnya