How to make dynamic routes work with the REST API?

Hey Team,
I’m learning plasmic and this is by far the best visual editor i’ve encountered. I have a background as webdesigner, but I work mostly in design and with no/low-code.
I followed the tutorials but unfortunately hit a wall. Maybe someone can push me in the right direction:

I use the rest-API module to fetch some API-data. I now want to use this data on dynamic pages/dynamic routing, something like a blog-layout where I click an article on the main page and get to an article page.
In the documentation you only show the way to do this with the plasmic CMS, not with the rest-API fetcher.
I have set the page to /[slug] but can only access this slug as dynamic data, nothing from the front-page. What is my next step?
Thank you!!

Hi @swift_silverfish, you can:

• Create your Post page at /posts/[slug]
• On that page, fetch data from your REST API keyed by the slug parameter, for instance "<https://restapi.com/api/data/?id=>" + slug
• Create the frontpage at /
• On that page, insert another REST API that gets the list of all posts, and for each one link to the Post page
Let me know if that helps! We have videos here on both creating dynamic pages and fetching from a REST API:

https://www.youtube.com/watch?v=BxkttuUOUQg

https://www.youtube.com/watch?v=u0pu41Awyaw

Hey @yang, Thank you very much!! This advice is great – I guess you could just paste this to the Plasmic Documentation, maybe it helps others, who are learning plasmic? :smile:

I now have a small problem following the last: I have built the dynamic page linking, and it works like a charm in the Plasmic Studio. But when I deploy my first draft to netlify suddenly none of my subpages loads (404) and i’m kinda stuck, why that happens…
This is the page: https://fantastic-yeot-8716b8.netlify.app/

The first Screenshot shows the configuration of my Frontpage, the second one of the API fetcher of the Post page – anything I’m missing?
Thank you very much!!

That’s interesting, how did you deploy this site? The only thing I can think of is if your getStaticPaths() function is not using fallback: "blocking", which Netlify does support—can you check what your getStaticPaths looks like? https://docs.netlify.com/integrations/frameworks/next-js/incremental-static-regeneration/#distributed-persistent-rendering

Thank you for your reply! I tried it at first using gatsby which brought me to the failing sites… Now I re-deployed the page as next.js-project and everything works just fine.
Thanks for your support!!