Json result and media tile

Hi all;
I have read this thread that is related to what I am looking for and I have several questions:

  1. some json sources return actual image urls. for exmple:

charts: {
swell: “http://cdn.magicseaweed.com/wave/750/1-1366902000-1.gif”,
period: “http://cdn.magicseaweed.com/wave/750/1-1366902000-2.gif”,
}

is there a way to point the media tile to the image inside the json result? in the thread I mentioned there was usage of an iagee generation URL with Query parameter to retrieve the data from the json and then convert the texto image but in this case the text is a link to the image.

  1. in some cases I will want to display combined formatted text (image text image) in the tile.
    for example the following json:

data:{
minHeight: 1,
maxHeight:2,
date: 1/1/20
}

in this case I would like to conbine all 3 value to 1 tile that will show something like:

            1/1/20
              1-2

any suggestions for both issues?
thanks!

You would likely need some external service to parse the JSON and transform it into the desired output format.

JSON with Media URL
For the JSON source that returns an image URL, if you could find something that could parse the JSON and then redirect to the desired URL, then you could use that as your Media Tile URL.

I can’t think of anything out of the box that will do that, but if you have some programming skills, you could write a script to do it.

Combining Text
Similar to above, you would need an external service to combine the strings together and then return the concatenated text.

Do you control the sources that are generating this data? Or could you provide some sample URLs?

Edit: Feel free to PM me the URLs if they include sensitive info like private API Keys.

1 Like

Thanks Josh. I have some control over the data. And I also consider myself to have good programing skills.
I will dive a little more and see what I can do.
Thanks again

Sounds good. If you need some help, feel free to PM me the sources and I’d be happy to help put a proof of concept together for you. :smiley:

For your image example, here’s a demo I put together using Node.js on Glitch using an API from the Cocktail DB.

Glitch: parse-json-and-redirect-image

The project queries the Cocktail DB API for ‘Margarita’, grabs the image URL in the first result, then redirects you to the image.

You can then use the Live App URL from Glitch directly in your SharpTools Media Tile:

1 Like

yep, code is very clear. I dont have node js in my toolbelt but I do have some JS and I have been working with libraries such as axios in the past so no issues understanding whats going on :slight_smile:
thanks.

2 Likes