Data seen in mariaDB but can not access in endPoint API


I’m beginner in ERPNext
I got empty curtly braces {} while using API endpoint


created custom app called ‘abc’ and created function ‘get_item_details’ in ’’ file

complete code in the ‘’ file :
import frappe
def get_item_details(item=None):
Item = frappe.db.sql(‘’‘select * from tabItem docType;’‘’, as_dict=True )
return item

file location : apps/abc/abc/

is there anything which i missed and can not see the output THOUGH I CAN SEE THE DATA IN MARIADB

Does this query return anything in you sql editor?

yes yes… complete details

Can you share a screenshot?

i can see the result in mariaDB

change that line to this

Item = frappe.db.sql(‘’‘select * from tabItem’‘’, as_dict=True )

tried, but same result

Use this response type and return it

from werkzeug.wrappers import Response
from frappe.utils import response as r

Don’t return simply a dict

If the above documentation is not working try this:

import frappe
from frappe.utils import response

def get_item_details(item=None):
  Item = frappe.db.sql("select * from tabItem", as_dict=True )
  response['http_status_code'] = 200
  response['data'] = Item

Note: If its not working add method type and hit with respective method like this

@frappe.whitelist(allow_guest=True, method='POST')

Thanks for your valuable time @TurkerTunali , @Antony_Praveenkumar , i appreciate your efforts.
it’s finally resolved and now i can get the data by creating a file called in my app’s config folder and wrote this code

def get_data():
return [{
“label”: _(“Masters”),
“items”: [
“type”: “doctype”,
“name”: “Item”,

this is for the ref : Custom app calling doctypes from different modules - #2 by Ben_Cornwell_Mott

but once again thanks a lot