How to consume the REST API in the local frappe work environment

I have followed through the Library Management System tutorial provided by the frappe framework. After completing the tutorial, I successfully, uploaded it to the cloud to consume the REST API by providing the “Authorization” in headers.

However, I can not do the same in my local setup because I do not know how to get an “Authorization”. I am running the Frappe server in Ubuntu by using VMware.

This is the response I got in my local setup without an “Authorization” token:
{
“exception”: “frappe.exceptions.PermissionError”,
“exc_type”: “PermissionError”,
“exc”: “["Traceback (most recent call last):\n File \"apps/frappe/frappe/app.py\", line 115, in application\n response = frappe.api.handle(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/api/init.py\", line 49, in handle\n data = endpoint(**arguments)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/api/v1.py\", line 27, in document_list\n return frappe.call(frappe.client.get_list, doctype, **frappe.form_dict)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/init.py\", line 1768, in call\n return fn(*args, **newargs)\n ^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/utils/typing_validations.py\", line 31, in wrapper\n return func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/client.py\", line 67, in get_list\n return frappe.get_list(**args)\n ^^^^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/init.py\", line 2032, in get_list\n return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/model/db_query.py\", line 114, in execute\n self.check_read_permission(self.doctype, parent_doctype=parent_doctype)\n File \"apps/frappe/frappe/model/db_query.py\", line 511, in check_read_permission\n self._set_permission_map(doctype, parent_doctype)\n File \"apps/frappe/frappe/model/db_query.py\", line 517, in _set_permission_map\n frappe.has_permission(\n File \"apps/frappe/frappe/init.py\", line 1090, in has_permission\n raise frappe.PermissionError\nfrappe.exceptions.PermissionError\n"]”,
“_server_messages”: “["{\"message\": \"User Guest does not have doctype access via role permission for document Article\", \"title\": \"Message\"}"]”,
“_error_message”: “No permission for Article”
}

Use session Id, In Local Storage you will get session Id.

You can also try one thing for clear understanding, that in local setup open browser refresh that page with Network tab open of console. Then you can view request. You can right click on request and do copy as C-url then you can convert to curl to any programming language you understand (https://curlconverter.com/).

So will you able to make API with postman understanding the code, what you require.