Passing argument via RPC?

I am not sure if this is appropriate, but I am trying to pass an argument to an rpc.

api/method/erpnext.crm.doctype.geoloc.new_loc

new_loc now looks like this by definition

@frappe.whitelist(allow_guest=True)
def new_loc(test):
return test

there is no authentication required.
I want to pass multiple arguments to new_loc()

Thanks!

@vivek are you planning to contribute this?

If yes, share the whole plan :smile:

Hi @vivek,

You can send the multiple arguments in the Request Body in (form_data),

Please refer to get Item Details via RPC

Thanks, Makarand

What I am trying to do is rather simple. There is a Free Geofencing Android App which lets you post http requests on events like moving into a fenced area and moving out of a fenced area. Its call “Egigeozone”.

I am trying to create a doctype via these http request.

I can contribute, but this is just a simple hack to fulfill a requirement to track sales person moving in and out of their designated client offices @rmehta

ok i am able to pass information!

1 Like

@frappe.whitelist(allow_guest=True)
def new_loc(test):
d = frappe.new_doc(“Geoloc”)
d.set(‘lat’, test)
d.save(ignore_permissions=True)
return d

d returns the new created doctype, but it isnt available in the list!? looks like it isnt being created in the db?

You need to use d.insert()

@Ben_Cornwell_Mott I tried with the same. But the result is the same . anything else i should try?

I haven’t used new_doc to create documents. I typically use get_doc instead. Here is a sample of some code I use that works.

ip_doc = frappe.get_doc({
“doctype”: “Item Price”,
“price_list”: price_list,
“buying”: 1,
“item_code”: item_doc.item_code,
“price_list_rate”: item_doc.rate,
“currency”: currency,
“item_name”: item_doc.name,
“item_description”: item_doc.description
})
ip_doc.insert()