Forum Discussion

arsenioferraz's avatar
arsenioferraz
Copper Contributor
Aug 01, 2023

Is it possible to get the SharePoint HUB navigation using REST API?

I have a top hub and a child hub. I want the child hub to have the same hub navigation as the parent hub.

Is there a way to get the navigation using REST API? I want to build an extension that will replace the child hub navigation.

  • SvenSieverding's avatar
    SvenSieverding
    Bronze Contributor

    Hi arsenioferraz 


    the Hub site navigation is basically just the "TopNavbar" navigation of the Hub site.

    So just use this endpoint

     

     

    <Hubsite>/_api/web/navigation/TopNavigationbar

     

     

    to get the root elements and then use the top level node IDs to get their children

     

     

    <Hubsite>/_api/web/Navigation/GetNodeById(<nodeID>)/children

     

     


    But if you want both hubs to have the same navigation: Why are you having two hubs at all? Could this be easier, if you just use one Hub?


    Best Regards,
    Sven

     

     

Resources