API/Backend Workflow to add list of url's to database, need to add text in front?

Sequence of events -

Sending an API call for a list of shirts, parsing information out, updating a database.

When pulling in images from the companies API, it gives them in a /images/thing.jpg format, without the url in front.

When creating a new database entry, I was simply able to do image = www.site.com/ in front of the dynamic text being brought in from the API. No problems, works great, no problem.

Now, I’m bringing in images of color swatches. it brings in the url for each swatch, but without the url in front. I want to add the url in front of the "result of step 1(api call): each item’s colorswatch.

I have tried using arbitrary text/append in a lot of combinations with no luck. It shows that it evaluates to a list of texts, but it shows up as red. I’m also not totally sure in the DB that a list of text will give me the ability to show it as an image, or do I need to be using it as a list of images? Either way, need to figure out how to slap this url in front of each entry. Any ideas?

Storing it as a text URL should be fine because your image element just asks for the URL.

Someone might have a better idea than me, but could you just store the url of colorswatch how it comes in, then when you display the image just put the www.site.com/ in front of the elements source url?

In my test app I was just trying a few things and you’re right, seems a bit tricky to put arbitrary text in front of each text in a list.

1 Like

It should be as simple as what you’ve already tried (i.e. just typing the URL in front of the rest of the image path)…

Can you share some more details about exactly why you’re unable to do that?

(although, as you’ve already alluded to, an image can only have a single URL… so you can’t save a list of URL’s to an image field… so perhaps that’s the issue you’re having?..)

Also, if the expression is showing up red, then the issue checker will tell you exactly why?.. so what does it say?

It tells me it evaluates to a list of text, which is where i’m trying to stick it…I’m thinking maybe its trying to put that url in front of the list, not each individual item by chance?

I don’t dislike the idea of using the url to display it after the fact, i’m going to adventure to see if I can figure it out in that way as well.

At the top right where it says “x errors” click that and see what the error is, it might show more detail. My first thought is a mismatched field type. Is the “color SwatchImage” text and your field is text?

I just went ahead and figured your suggestion to just use that url later in the image is probably better. What I don’t know yet is that I intend to use it in a repeating group of images, which will be dynamically shown based on which previous shirt you have clicked.

Both were text, so yeah, I am not totally sure. I did save a break point to be able to go back to that rendition of things, but as it stands I guess i’m going to see if I can make it work as you suggested, inserting the URL. Repeating group will be interesting (probably easy for most, new to bubble haha)

That’s exactly the issue… to resolve it you’ll need to do the following…

  • Format the list as text, and add the root URL to each item
  • Then split that text back into a list

So, specifically, use ‘Set List’ (or Add List): Results of step 1 (S&S Activewear PR...): each item's colorSwatchImage: formated as text

For ‘content to show per list item’ enter: www.site.com/this text and just use a comma for the delimiter…

Then use ‘spit by’ and split by a comma to turn the text back into a list of texts.

1 Like