I write this code as a custom api to get all data from doctype without login. Turiya has a child doctype[TuriyaData] that doctype value is fully null. how to get the data like api/resource/turiya
@frappe.whitelist(allow_guest=True)
def get_turiya_data():
data = frappe.db.get_all(‘Turiya’, filters={‘name’: id}, fields=[‘*’] )
return data
Hi bro,
thank you for the reply. I am also getting the data for Turiya.
But Turiya has child doctype that child data is fully null. without joint the parent and child doctype can we get the data fully like api/resource/turiya
You can’t get the child table data without a parent.
If parent data then will display the data of the child table.
But you can define it like this if you comfortable with it.
Without id:
import frappe
@frappe.whitelist(allow_guest=True)
def get_so_data():
data = frappe.db.get_all('Sales Order', fields="`tabSales Order Item`.item_code,`tabSales Order Item`.qty")
return data
Then will only show the child table data of all sales orders.
import frappe
@frappe.whitelist(allow_guest=True)
def get_so_data():
data = frappe.db.get_all('Sales Order', fields="name, customer, `tabSales Order Item`.item_code,`tabSales Order Item`.qty")
return data