Hello,
We are trying to use your API but getting the error. So we are mentioning the CURL request and error response. So please check it and let us know the issue.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://demo.erpnext.com/api/resource/Customer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_HTTPHEADER => array(
"Authorization: Token demo:demo",
"Content-Type: application/json",
"Accept: application/json"
),
));
$result = json_decode(curl_exec($curl), 1);
$err = curl_error($curl);
curl_close($curl);
[exc] => ["Traceback (most recent call last):\n File \"/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/app.py\", line 60, in application\n response = frappe.api.handle()\n File \"/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/api.py\", line 120, in handle\n doctype, **frappe.local.form_dict)})\n File \"/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/__init__.py\", line 1051, in call\n return fn(*args, **newargs)\n File \"/home/frappe/benches/bench-version-12-2020-02-24/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/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/__init__.py\", line 1287, in get_list\n return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)\n File \"/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/model/db_query.py\", line 43, in execute\n raise frappe.PermissionError(self.doctype)\nfrappe.exceptions.PermissionError: Customer\n"]
[_server_messages] => ["{\"message\": \"User Guest does not have doctype access via role permission for document Customer\"}"]
[_error_message] => Insufficient Permission for Customer
Thanks!