Add REST APIs to ERPNext for having new view at system

Good Day
I created a basic system that works out of the box without any code.
My DocType have 3 rows (first_name, last_name and id_number), but I only can see one field at my app’s view. I need to show all of my rows at the app’s view so I want to use API for this purpose.

  1. how can I add REST API to my app and where should i create my APIs? (I mean the folder’s location that i need to put my APIs file)

  2. Is this possible to create a PHP API for adding any new view to the eronext? if yes, please tell me the process of adding PHP APIs to the system.

Thank you

app’s view ?? if you want the fields to show up on list view then in doctype field check the option In List View

You can add your REST API method in doctype, create the API method and make it as whitelist so you will be able to access the method.
def get(args1, args2 .., argsn):
or you can create new Module Def for REST API create python files and write your API methods.

to call REST API method you will need to provide the full path to the method please check for API details.


1 Like