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()