How to customize the api path

Hi, Guys:
I need to expose an api to a third party, but they have requirements for the format of the api.
My original api is /api/method/expnext_extension.api.customer.retrieval, and the third party’s requirement is /api/retrieval.
I added the following definition to expnext_extension/hooks.py:

api_routes = [
{
"from_route": "/api/retrieval",
"to_route": "expnext_extension.api.customer.retrieval",
"methods": ["POST"],
}
]

But it doesn’t work.
Is there any other way? How should I do it?

I found resolution here

Property in hooks.py:

override_whitelisted_methods = {"retrieval": "expnext_extension.api.customer.retrieval"}

The final call:

curl --location 'http://[your-site]/api/method/retrieval' \
--header 'Content-Type: application/json' \