Hello Expert,
I wrote a API function in /home/vagrant/frappe-bench/apps/spms/spms/api.py
import frappe
@frappe.whitelist()
def ping():
return 'pong'
Also created a user api-user and generated API Key and API Secret
use this in header Authorization: API Key:API Secret in postman.
But getting below error:
18:59:14 web.1 | Traceback (most recent call last):
18:59:14 web.1 | File "apps/frappe/frappe/app.py", line 110, in application
18:59:14 web.1 | response = frappe.api.handle(request)
18:59:14 web.1 | File "apps/frappe/frappe/api/__init__.py", line 49, in handle
18:59:14 web.1 | data = endpoint(**arguments)
18:59:14 web.1 | File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
18:59:14 web.1 | return frappe.handler.handle()
18:59:14 web.1 | File "apps/frappe/frappe/handler.py", line 49, in handle
18:59:14 web.1 | data = execute_cmd(cmd)
18:59:14 web.1 | File "apps/frappe/frappe/handler.py", line 82, in execute_cmd
18:59:14 web.1 | is_whitelisted(method)
18:59:14 web.1 | File "apps/frappe/frappe/__init__.py", line 821, in is_whitelisted
18:59:14 web.1 | throw(msg, PermissionError, title="Method Not Allowed")
18:59:14 web.1 | File "apps/frappe/frappe/__init__.py", line 565, in throw
18:59:14 web.1 | msgprint(
18:59:14 web.1 | File "apps/frappe/frappe/__init__.py", line 537, in msgprint
18:59:14 web.1 | _raise_exception()
18:59:14 web.1 | File "apps/frappe/frappe/__init__.py", line 488, in _raise_exception
18:59:14 web.1 | raise exc
18:59:14 web.1 | frappe.exceptions.PermissionError: You are not permitted to access this resource.Function spms.api.ping is not whitelisted.
Seems user is not allowed to access the function. What role should I give to user api-user?
Please help.