This page documents the endpoints that power the storefront homepage: the hero section, the navigation bar, and the top-selling products carousel for each product category. All content is managed in ERPNext under Medusa Integration → Homepage Landing → “Active Homepage Landing”.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aerele/medusa_integration/llms.txt
Use this file to discover all available pages before exploring further.
GET get homepage top section
GET /api/method/medusa_integration.api.get_homepage_top_section
Returns the hero/top section content from the active Homepage Landing document. Each entry is either an Item Group with sub-categories or a Brand with associated product categories.
No request parameters.
Response
Array of entry objects. The shape varies bytype.
"Item Group" or "Brand".Name of the Item Group or Brand.
Absolute URL of the attached image.
null if none.custom_medusa_route of the Item Group. Only present on "Item Group" entries.First-level child Item Groups with their routes. Only present on
"Item Group" entries.Item Groups that carry products from this brand. Only present on
"Brand" entries.Content is managed in ERPNext via Homepage Landing → Active Homepage Landing → top_section child table.
Example
Response
GET get homepage menu section
GET /api/method/medusa_integration.api.get_homepage_menu_section
Returns the navigation bar entries from the active Homepage Landing document. Only Item Group entries are included; Brand entries are ignored.
No request parameters.
Response
Array of menu link objects.Item Group name, used as the menu label.
custom_medusa_route of the Item Group.Content is managed in ERPNext via Homepage Landing → Active Homepage Landing → menu_section child table.
Example
Response
POST fetch relevant collection products
POST /api/method/medusa_integration.api.fetch_relevant_collection_products
Returns pre-computed top-selling products for the top-level collection that contains the given item_group. Use this endpoint to populate “Top Products” carousels on the homepage or category pages.
Request body
ERPNext Item Group name. The endpoint resolves this to one of the four supported top-level collections: Dental, Medical, Infection Control, or Medical Laboratory IVD.
Response
The resolved top-level collection name:
"Dental", "Medical", "Infection Control", or "Medical Laboratory IVD".Top-selling products for the collection, sorted by
sales_count descending.Product data comes from the Product Collection doctype, which is refreshed nightly by the
add_top_selling_items_to_collection scheduled task. The response reflects the state of the last nightly run, not real-time invoice data.Example
Response
POST add top selling items to collection
POST /api/method/medusa_integration.api.add_top_selling_items_to_collection
Recalculates the top-selling items for each category and updates the Product Collection singleton doctype. This endpoint requires authentication.
This endpoint is also executed automatically on the nightly cron schedule defined in hooks.py (0 1 * * *). Call it manually to force an immediate refresh without waiting for the scheduled run.
No request parameters.
How it works
For each of the four categories — Dental, Medical, Infection Control, and Medical Laboratory IVD — the endpoint:- Finds all Item Groups in the full hierarchy under that category name.
- Queries
Sales Invoice Itemrecords from submitted invoices for items in those groups. - Groups by
item_codeand sums quantities to determine total units sold. - Selects the top 20 items by total quantity.
- Replaces the corresponding child table on the Product Collection doctype.
Response
"success" on completion, "error" if an exception occurred.Human-readable result message.
Response