skip to Main Content

If anyone can please help me with how to retrieve the navigation menu with REST and Graphql API.

If no API is available, then how can I write a custom Navigation API?

We need to get the below data with API. see screenshot

2

Answers


  1. currently, there is no API endpoint that would allow you to access the navigation. However, seeing that the navigation in your screenshot mainly contains collections, probably it would be a good starting point for you to read those? This can actually be done via this call:

    GET /admin/api/2020-01/collection_listings.json

    You can find more info here:

    https://shopify.dev/docs/admin-api/rest/reference/sales-channels/collectionlisting#index-2020-01

    Hope this helps,
    Roman

    Login or Signup to reply.
  2. Use this in query. it worked for me. Remember to replace "main-menu" with the header code of your site.

    {
      menu(handle:"main-menu"){
       items{
        id
        tags
        title
      }
      }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search