Export Route/Component Tree (API Endpoints)

It would be awesome to have an API that allowed us to get the component hierarchy and tree structure that's built from each design. This could be really cool for building new components in React. Ideally I just want to fetch for a site or specific route and get back the tree structure of that route.

For example...

If I sent a GET to https://api.webflow.com/v?/sites/:site_id/tree

It would give me the full site tree as I named it.

  • Body
    • Section
      • Home Hero
        • Intro Box
          • Heading
          • Sub Heading
        • Opt In Form
          • Input Box
          • Submit Button

That way I could literally compile that tree to a react tree and add in attributes/custom data on the fly.

It would be even more awesome if I could also get the respective styles for each element in the tree.

So for example...

```

{

"body": {

  "id": 2f24fk5hash,

  "styles": {

    background: "blue"

  },

  "components": {

    "section": {

      styles: { background: "green" }

    }

  }

}

}

```

If I wanted to have a specific component, I could fetch it uniquely.

https://api.webflow.com/v?/sites/:site_id/tree/2f24fk5hash/tree

For routes, you could do...

https://api.webflow.com/v?/sites/:site_id/routes/:route_id

This could give you the site's routes if they weren't already on the site object. If you wanted to have the components on their own store (denormalized).. maybe

https://api.webflow.com/v?/trees/:site_id/routes

https://api.webflow.com/v?/trees/:site_id/routes/:route_id/tree

https://api.webflow.com/v?/trees/:site_id/routes/:route_id/2f24fk5hash/tree

  • Cameron Roe
  • Mar 11 2018
  • Abruptive Team commented
    August 28, 2019 11:32

    Hey Cameron,

    Just replied to your other wishlist thread. You can use that to export to React, and then bind your components to the Webflow CMS API for content. Hope that helps.

    Cheers!
    Alex

  • +4