Hello everyone,
I am having an issue with the notation of Frappe’s REST API URLs. Normally, URLs are structured like this:
http:///api/method/frappe.auth.get_logged_user
the URL has dot notation and underscores in it.
I’m wondering if there’s a way to route this URL to another URL, and if so, how can I do it?
Thank you in advance for your help.
@Mina_Rizk Yes you can, REST API on frappe actually call to the function.
So when it says “frappe.auth.get_logged_user” then that means it refers to “get_logged_user” function on auth.py.
Therefore you can call the function to the new function somewhere else.
And don’t forget to add @frappe.whitelist()
before function
**Note
- i think you cannot change the
/api/method/
in the url
- the base url is up to you, as long it can be open in the browser so like
http://localhost:3000/api/method/dotted.path.to.function
its allright
References
https://frappeframework.com/docs/v14/user/en/guides/integration/rest_api
1 Like
@antzforwork Yes, I need to call the REST API but would like to route the default URL that have a dot to be like /api/method/notdotted/link how can approach this?