API URL to call a custom method

Written a custom method as white-listed in erpnext/api.py , for a form creation according to some logic but cannot seem to find the right url to trigger ,
method name is test
tried as post method

  1. url/api/method/test
    2.url/api/method/erpnext.api.test
    3.url/api/method/erpnext.erpnext.api.test
  2. url/api/method/erpnext.api.test.test where second test is the form name which i want to create

everyone gives me a 404 method not found error
image

login method works just fine.

what is the right url to hit or am i missing something?

thanks

Hi @Taher_Khalil,

I am not really sure which erpnext/api.py you have modified. But why not create a new app for your new logic and add this function to this? Refer to this for details: https://frappe.io/docs/user/en/guides/integration/rest_api

E.g. place the function in the __init__,py of your app and call as /api/method/sample_app.test

Also, you might be able to troubleshoot using bench execute <your function>

Hope this helps.

Thanks , i figured it out,
it was not getting response because of some programming errors in the code , once i commented some parts and tested it , it worked fine ,

it seems if there are any errors in calling a document from within api method it does not compile or get called and gives invalid method error , so should be sure to clear those .

but now i got some other queries regarding the updating a child table , but better to open another thread for that ,

thanks , you can close this thread.