Hello,
I have trouble using the API with Token Based Authentication as described at:
https://frappe.io/docs/user/en/guides/integration/how_to_set_up_token_based_auth
I want to make API calls without Cookie Sessions.
I have checked that I have the ‘system manager’ role
I get the API Key and API Secret from ‘My Settings’:
I use Postman (Download Postman | Get Started for Free) to test and check my API calls, and I do the following request:
GET /api/resource/Customer HTTP/1.1
Host: 192.168.39.125:8080
Content-Type: application/json
Accept: application/json
Authorization: Token bad123456789012:dc08fa78bd1209
User-Agent: PostmanRuntime/7.15.2
Cache-Control: no-cache
Postman-Token: 73e480fb-d808-4eb6-a9ee-b3316d31bbf9,29789231-d811-452c-ab60-90818ef947d4
Host: 192.168.39.125:8080
Accept-Encoding: gzip, deflate
Connection: keep-alive
cache-control: no-cache
The response is "“User do not have doctype access via role permission”:
{
"_error_message": "Insufficient Permission for <b>Customer</b>",
"exc": "[\"Traceback (most recent call last):
File \\\"/home/paul/erpnext-11.1.38-0/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/app.py\\\",
line 66, in application\\n response = frappe.api.handle()\\n File \\\"/home/paul/erpnext-11.1.38-0/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/api.py\\\",
line 114, in handle\\n doctype, **frappe.local.form_dict)})\\n File \\\"/home/paul/erpnext-11.1.38-0/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/__init__.py\\\",
line 1032, in call\\n return fn(*args, **newargs)\\n File \\\"/home/paul/erpnext-11.1.38-0/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/client.py\\\",
line 35, in get_list\\n limit_start=limit_start, limit_page_length=limit_page_length, ignore_permissions=False)\\n File \\\"/home/paul/erpnext-11.1.38-0/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/__init__.py\\\",
line 1260, in get_list\\n return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)\\n File \\\"/home/paul/erpnext-11.1.38-0/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/model/db_query.py\\\",
line 42, in execute\\n raise frappe.PermissionError(self.doctype)\\nPermissionError: Customer\\n\"]", "_server_messages": "[\"{\\\"message\\\": \\\"User do not have doctype access via role permission\\\"}\"]"
}
Can somebody tell me what I’m doing wrong?
versions:
client: macOS Mojave
server: Bitnami ERPNext instance (ERPNext Cloud Hosting, ERPNext Installer, Docker Container and VM)
ERPNext: version v12.x.x-develop () (develop)