Parsing REST API results and printing the results in a loop
I'm creating a typebot that gets search results via rest API. I have tried formatting the result but instead of displaying all the results I only get 1 result. I'm using the WordPress search API. I'm assigning the result to a variable called search_result. Is it possible to display an image in the results loop? Anyone please help 🥹.
{
"statusCode": 200,
"data": [
{
"id": 19527,
"title": "Kibuye Market",
"url": "https://testsite.com/map/kibuye-market/",
"type": "post",
"subtype": "map",
"_links": {
"self": [
{
"embeddable": true,
"href": "https://testsite.com/wp-json/wp/v2/map/19527"
}
],
"about": [
{
"href": "https://testsite.com/wp-json/wp/v2/types/map"
}
],
"collection": [
{
"href": "https://testsite.com/wp-json/wp/v2/search"
}
]
}
},
{
"id": 19526,
"title": "Kisumu Museum and Snake Park",
"url": "https://testsite.com/map/kisumu-museum-and-snake-park/",
"type": "post",
"subtype": "map",
"_links": {
"self": [
{
"embeddable": true,
"href": "https://testsite.com/wp-json/wp/v2/map/19526"
}
],
"about": [
{
"href": "https://testsite.com/wp-json/wp/v2/types/map"
}
],
"collection": [
{
"href": "https://testsite.com/wp-json/wp/v2/search"
}
]
}
}
![No description](https://cdn.answeroverflow.com/1239918572197908600/Screenshot_2024-05-14_152842.png)
4 Replies
In your http response, where are the image URLs? I don't see those
Excluded in the request but can be, first things first is how to format this output into readable text/html, possibly hyperlinked images. I can hopefully build on that but first how to format the result. Thanks for taking this up, really appreciate it
You can use an Image bubble block and insert a variable as a URL to display an image
Hi @Baptiste , I'd like to join the conversation.
I'd also be very interested in understanding how to display the different returns from a call api in several bubbles?
I'd imagine one bubble for each place name returned by the api, as shown in the example above.