Beginner level question - data accessibility issue after creating custom app

just started ERPNext journey and really need community support.

I have created a few ‘items’ and I want to access the item data in my custom app named abc, is it possible?
I tried to do the same and only got an empty response {}.

Hello,

You need to explain how do you want to access Item data in you custom app.

Generally defining a field to type Link and then setting Item as its option should allow you access Item in your custom app.

After creating few ‘ITEMs’ and later if I’ll create custom app (let say : ‘xyz-app’), can I access the xyz data using custom API (is custom app data connected with mariaDB and can I get the data while using custom API ?
Or is there a process for integration that I should think about?

i had created ‘api.py’ file inside my custom app xyz with function named : ‘get_item_details’

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

http://localhost:8000/api/method/xyz/api.get_item_details output : {}

file location : apps/xyz/xyz/api.py

Hello @YogiYang ,

Thanks a lot for your time and efforts

Just got solution, ref : Custom app calling doctypes from different modules - #2 by Ben_Cornwell_Mott

it’s finally resolved and now i can get the data by creating a file called abc.py 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

Yes, it is possible to access item data in your custom app in ERPNext.

To access item data, you can use Frappe’s built-in API to fetch the data. Here’s an example of how you can fetch item data using the API in your custom app:

import frappe

def get_item_data(item_code):
item_doc = frappe.get_doc(‘Item’, item_code)
return item_doc.as_dict()

This function will fetch the item data for a given item code and return it as a dictionary. You can call this function from within your custom app and use the item data as needed.

Note: Make sure that you have permission to access the Item doctype and that the item you are trying to fetch exists in the system. If you are still getting an empty response, you may want to check if there are any errors in your code or if the API request is being made correctly.