APIs & Integrations

cjisndenial
Participant

Retrieve CMS Menu Object as JSON

Not sure if this should be an API or CMS post, so taking a shot in the dark.

 

We would like to retrieve a Menu object from HubSpot CMS as JSON data.  Is there a way to do this programaticaly?  

 

Why would we want to do that?  Well we have a seperate app served up on some routes that we would like to "appear" to just be part of the site.  Effectively trying to make this so by having identical menus between HubSpot pages and the app, so the users have a seamless experience.  Anyone with expeirence doing this, would love to know your method.

 

Thanks!

0 Upvotes
2 Replies 2
cjisndenial
Participant

Retrieve CMS Menu Object as JSON

Thanks Mike.  We discovered this method during our POC, but had hoped to find something a bit more direct / less fragile.  We certainly can do it to parse the menu data structure.

 

If we go this route, we're maintaining two copies of the primary navigation code.  One that serves from HubSpot and server-side renders using hubl, and one that serves from our application and server-side renders using node.js and the data structure we've scraped from the aformentioned HubSpot page.  Wondering if anyone else has discovered a more elegant solution to this challenge.

0 Upvotes
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

Retrieve CMS Menu Object as JSON

Hi @cjisndenial 

 

The Menus – as far as I know – are not available via the API.

 

The Menus are only available in a Template.

 

So, what if you made a template that rendered the menu – in JSON – and create a page that only serves a menu?

 

Could your system parse the Menu that way?

 

Mike

0 Upvotes