Rewrite the API

How to rewrite API interface, different from/API /method/{method} format, such as /ipa/dohtem/,There seems to be no documentation on how the interface starts to be called,If there is any document about the calling process, please reply, thanks

Hi

In hooks.py have config override method.

Overriding Whitelisted Methods

------------------------------

override_whitelisted_methods = {

“frappe.desk.doctype.event.event.get_events”: “bdtheme.event.get_events”

}

Thank you, but how can I use the new method (override_whitelisted_methods) to reconstruct the interface form I need, such as changing/API /method/{method} to /a/b for access

Hi

#1 You create your app
#2 create api.py
#3 edit override method in hooks.py

This file, which has been written in hooks. Py, is not functional
override_whitelisted_methods = {
“/api/method/frappe.core.doctype.user.user.iclock”:“/a/b”
}

Hi

You create app. “/a/b” => "yourapp.a.b"and create your app , a.py and b method.

hi
This access format is still; “method.name” can’t “method/name”

Hello, I tried to do a refactoring, but did not find the correct way to rewrite

return value {" A “:” B "} AB are both function methods. Can we only call the interface through https://localhost/ API /method/{method name} this way?

Hi

I don’t understand your way. I don’t have idea about change route of API. I think can create page with your route then call API.

hello

The method is feasible, first create the page, and then access the method through the page, but when using it, it will return the HTML page, the required return value is in the successful funtion, this is not the return result I want, how to modify here, so that the return result is the back-end return value (e.g. ‘json’), rather than HTML

Hi

Can use rewrite url of ngnix?

Hi
it works ! thanks a lot !:wink:

Hi

You use rewrite of ngnix? Could you share your solution? Thanks

Hi
Add the following code to the nginx.conf file

Server {

When # visits /last.html, the content of the page is overwritten in /index.html

rewrite /last. html /index.html last;

}

1 Like