Join the Webstudio community

Updated 4 months ago

Slug variable from an API resource?

At a glance

The community member is testing out Pocketbase, which has a REST API but no GraphQL. They are trying to get the slug variable to go in the URL path /post/:slug from a Resource, rather than using GraphQL. Other community members suggest that the slug variable can be passed as a query parameter in the REST API, and provide examples and a helpful YouTube video to guide the original poster. There is no explicitly marked answer, but the community members work together to help the original poster resolve their issue.

Useful resources
Hi, is it possible to get the slug variable to go in /post/:slug from a Resource rather than GraphQL?

Context is I'm testing out Pocketbase https://pocketbase.io which doesn't have GraphQL, only an API

Thanks in advance
O
R
7 comments
you mean pocketbase has rest api and you need to use slug variable from the url and pass it as query params to the rest api
I don't see a problem from what you described
Thanks for the quick reply. I'm quite a newbie at this stuff, so not sure I've explained it well

If it had GraphQL I could write the query in this first screenshot to get the slug and pass it

But the Resource type doesn't have anywhere to write the query
Attachments
image.png
image.png
in resource the query pararams are part of the URL, called "get parameters"
check out our youtube, we had examples for using REST
Thanks, I'm all set and it's working now - this one helped a lot https://youtu.be/3mW7cPDXIxY?feature=shared
Great, let us know if there is anything in the documentation that can be improved that would have helped earlier
Add a reply
Sign up and join the conversation on Discord