How to work with Frappe using REST APIs

These are the pages I have created using the Frappe tutorial for the library management system.

Now, I want to access and manipulate these with REST APIs. How can I achieve that? I have tried following this “REST API” but the response is unexpected.

Hi @mayank_gupta:

Check the url you are using for consuming API.
Doctype name should have not ":" at the start …
yoursite.com/api/resource/article

Hope this helps.

Hi, Thanks for the help. But it is not working. and I am getting the following errors:

16:11:07 web.1 | Traceback (most recent call last):
16:11:07 web.1 | File “apps/frappe/frappe/app.py”, line 115, in application
16:11:07 web.1 | response = frappe.api.handle(request)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/api/init.py”, line 49, in handle
16:11:07 web.1 | data = endpoint(**arguments)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/api/v1.py”, line 27, in document_list
16:11:07 web.1 | return frappe.call(frappe.client.get_list, doctype, **frappe.form_dict)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/init.py”, line 1768, in call
16:11:07 web.1 | return fn(*args, **newargs)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/utils/typing_validations.py”, line 31, in wrapper
16:11:07 web.1 | return func(*args, **kwargs)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/client.py”, line 67, in get_list
16:11:07 web.1 | return frappe.get_list(**args)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/init.py”, line 2032, in get_list
16:11:07 web.1 | return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/model/db_query.py”, line 185, in execute
16:11:07 web.1 | self.columns = self.get_table_columns()
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/model/db_query.py”, line 546, in get_table_columns
16:11:07 web.1 | return get_table_columns(self.doctype)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/model/meta.py”, line 73, in get_table_columns
16:11:07 web.1 | return frappe.db.get_table_columns(doctype)
16:11:07 web.1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16:11:07 web.1 | File “apps/frappe/frappe/database/database.py”, line 1197, in get_table_columns
16:11:07 web.1 | raise self.TableMissingError(“DocType”, doctype)
16:11:07 web.1 | pymysql.err.ProgrammingError: (‘DocType’, ‘article’)

Hi @mayank_gupta

Answered here …

Thanks, it worked…