Error when calling Item api

hello,
I have 2 questions
1- when calling RestAPI for “api/resource/Item” only got 19 items not all?!
2- how can I call api to get Items which enabled “Show in Website” without login authentication?

#1 Read about Pagination in this documentation .

1 Like

anyone can help me with #2 question?

There are 2 ways.

  1. Give read permission for Item to the Guest role and use resource API:

    e.g. http://localhost:9090/api/resource/Item?filters={"show_in_website": 1}

  2. Write whitelisted python function to get required data

e.g.

@frappe.whitelist(allow_guest=True)
def get_items():
	return frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'],
		filters={'show_in_website': 1})
1 Like