Get doctype Metadata from Rest API

Hi,

Is there anyway to get a doctype metadata (fields list, types, etc …) through the Rest API ?
For example in Django Rest Framework we have the possibility to send a OPTIONS type request to an API endpoint and get some useful metadata information that allow us to automatically build a form to make POST queries to that specific endpoint.
In ERPNext I tried to send a request to (base-url/api/method/frappe.get_meta?doctype=Item) for example but it seems get_meta is not whitelisted and can’t get called this way.
Any suggestions regarding this topic would be much appreciated.

Best regards.

You can write a simple server script API as a workaround.

You can call this api using the method name.

{{host}}/api/method/get_meta?doctype=Item
4 Likes

Great, thanks for the quick response. Now I get Not Permitted, You do not have enough permissions to complete the action even though I’m logged in as administrator and even when I check :white_check_mark: Allow guest.

1 Like

I figured it out. Server Side Script had to be manually enabled with bench --site sites.local server_script_enabled true.
It worked.