Try ERPNext Buy Support Partners Foundation

Item Group Tree in REST API

I want to have Item group data in rest api as per parent and child. Currently it returns all Item Groups in 1 line and hard to tell which is parent of which.

I’m making 1 frontend client so need to parse Parent > Child > Sub Child > Sub-Sub Child like this.

http://localhost:8000/api/resource/Item Group?limit_page_length=100

Above returns all in 1 line like

data": [
{
“name”: “Vitamins”
},
{
“name”: “Sub Assemblies”
},
{
“name”: “Services”
},
{
“name”: “Raw Material”
},
{
“name”: “Products”
},
{
“name”: “Home Medical Care”
},
{
“name”: “Herbal Supplements”
},
{
“name”: “Health Supplements”
},

Hi you can use this:

http://localhost:8000/api/resource/Item%20Group?fields=[%22name%22,%20%22parent%22]&limit_page_length=100

For more info check this: https://frappeframework.com/docs/user/en/api/rest#listing-documents