Hi. Maybe it’s a newbie question, but I can’t see the variable ID as shown in the Rick&Morty API tutorial.
Where can I find it now ?
See image below.
Thx for any help.
Hi @JBDev
The Rick & Morty API tutorial was recorded before we made the variables available in the formula tab.
You can now find and bind the variables directly in the var
tab:
Or the user
tab if the variable you are looking for is related to an authenticated user:
Does that help?
Hi
Thanks.
Maybe a newbie question : can you just show me how to bind this “characterid” var in a query.
Tried multiple ways, but the character data is not loaded in the queries down the line.
Can’t replicate this timestamp in the video Work with REST API data in WeWeb - YouTube
thx
Sure!
Since the Rick & Morty API expects a URL with the character id ad the end, you’ll need to concatenate the URL path with the characterId variable at the end.
There are several ways you can do this.
1- Simply add a +
sign in between the URL and the variable:
2- Use the concatenate
formula to join the two:
If you hover over the concatenate
formula (or any other no-code formula for that matter!), you’ll be able to see how it works:
Just remember to place the URL path in between quotes so the browser recognizes it’s a text (also called string).
You don’t need to place the characterId variable in between quotes because variables of type Query are automatically recognizes as strings:
Does that make sense?
Hello Joyce,
I tried to do this tutorial but it doesn’t work. When I click on the collection item, it opens the page but not the correct associated item.
Can you help me please ?
Here is what I tried :
I have also created a variable. The name of this variable is “characterid”, type : query, defaultvalue : 1
can you tell me where i made a mistake please ? thank you for your help
Hi @msq
It looks like your API call is correct. A couple of things to check:
- is your
character
collection refetched and up to date with the correct item? - does your workflow work if you test each action one after the other?
- is the data on your item page bound to the
character
collection?
If not, maybe this video on how to create a dynamic collection page can help.
Let me know!
Hello Joyce,
Ok thanks for the information. I saw your video (I chose option 2) and I made some changes but I still can’t get it.
Maybe if I add more images you will be able to see where I made a mistake ?
thank you
Hi @msq
Ok the issue is the following: it looks like you’re mixing the two approaches together.
If you choose option 2 in the video referenced above, you don’t need to create the characterid
query variable. Instead you should bind the character
collection to the param
variable you have on your character page.
By the way, param
is the name by default when you create the first parameter on a dynamic collection page but you can change it to whatever you want, maybe characterid
in your case.
In order to bind the dynamic parameter of the collection page in your REST API collection:
- make sure you’re on the character collection page
- then go to your character collection
- bind to the variable “From path in current page”
In the tutorial, it’s this step. In our example, the page parameter is called ticket_id
:
Does that help?
Hello,
I had the same issue (no id displayed) and found this page (BTW: such important changes should be mentioned in the video description and not in a reply to a comment). But whatever I do, I can’t figure out how to display the details for a person selected on the “characters” page. I followed the procedure for option 1 (+; with query string) first (didn’t work) but I don’t understand how to implement option 2 (concatenate). I just can’t find the UI options displayed in your sample screen which is also for a completely different project. Achieving the desired result is crucial since without implementing such a use case successfully WeWeb is useless for us.
This tutorial seems to be outdated; WeWeb told me they will remove it. But I found another way achieving the desired result although I’m not sure if it’s the most efficient solution.
Hello Joyce,
First of all, thank you for your efforts . I had the same issue as JBDEV, and I followed the tutorial using the concatenate technique. Initially, after testing, I still had Rick’s character, even after trying with other characters. I thought it wasn’t working, but then I had the idea to refresh the page (F5), and the expected character appeared.
My question is: Is this a bug in the editor, or am I not doing things correctly, or is it because I have a free account and my account is limited?