Embedding media in custom websites using REST API

Hi everybody!

We’ve recently made a change to make the REST API more useful.

Before you wouldn’t be able to use the REST API to directly use Shotgun thumbnail or attachment URLs for any custom webpages you’ve written, but now your code should be able to use those values directly without being blocked by the browser.

This is useful for things like iframes on canvas pages where you just want to have your JavaScript call through to the REST API and display a set of images from Shotgun.

6 Likes

Sounds interesting. I have been building a slack bot that alerts artists when their tasks are updated and I have tried to find a way to have thumbnails in those messages but slack cant download the pictures from the thumbnail link and if I use the direct link to S3, it will expire after a while. Do you have any recommendations how to do this?

1 Like

Hi @xizted,

I haven’t put a ton of thought into this but, off the top of my head this would be the first thing I’d try:

Implement a small web server (Flask?) with a known URL scheme that includes the entity type and entity id. This would act as a small proxy possibly with a cache.

In the Slack message, instead of putting an image URL to Shotgun, put an image URL to your web server. The server would then connect to Shotgun to get a fresh URL download the image from S3 to the cache and then serve it to Slack.

I’m not sure how much latency this would introduce, like I said this is off the top of my head.

1 Like

I did try that but it seemed too complicated and wasn’t worth the trade off so we just disabled thumbnails on the slack messages. Obviously they are not a requirement and the messages work by themselves but if there would be an easy way to add them in I would.

1 Like