Get "preview image" with postman

Hi,

Is it possible with your API to get some sort of “preview image” from a layout/template?

Frank

Thank you for your message. My apologies if you saw my original reply, I provided a link to the incorrect method. When you Preview a Layout it is generated in the web browser when using your CMS, meaning it therefore cannot be retrieved using Postman.

You can however use Postman to return a screenshot from your Display, which will show you the Layout as it is being shown on that Display. To do this you would make a GET call to:

/api/display/screenshot/{displayId}

This will return a screenshot to Postman from that Display ID you entered.

Many Thanks.

Hi Dan - is this a public API? i’m getting an internal server error when I try and use this:

{
“error”: {
“message”: “Unexpected Error, please contact support.”,
“code”: 500,
“data”: []
}
}

Ignore me… i was testing this with a display that didn’t have a layout assigned - doh!

Anyone reading this - it works, it returns a jpeg

So this does an active request for a screen shot? It’s not quite working for me.

I have turned on my viewing of the most recently requested thumbnails in the DISPLAYS / Displays page. There, right-clicking those thumbnails gives something like “http://media.mydomain.com/display/screenshot/2?461aefd209a772715ccd”. So that’s showing the most recently requested, not the current?

But from Chrome or ‘wget’ of “http://media.mydomain.com/display/screenshot/2”, I’m getting something that might be a JPEG but it seems to be sent as [text/html] and those headers too.

If the display is off, I got a 404 inside a JSON.

Hey jfoust - if you save the entirety of what you are getting back as file.jpg you should have your screenshot

That’s what I’m saying - I don’t get a JPEG. I can see HTML headers being sent, and I can see JFIF data later on, but because it was sent as text, I can’t even trim out the JPEG to prove it’s there. Does this indicate a problem in Xibo or in the Apache config?

could you share your response here?

You can try to save response and name it as filename.jpg.
Then you must be able to see the image.

1 Like

Here’s the header of the file that gets saved. As you can see, it’s being sent as text, not binary. Some of the HTML is being stripped out of what’s here. The first line is a PHP comment of “saved from url=” and the URL of the display screenshot. Then the HTML head, meta, content-type, etc. Then the JS you see here.

.notifyjs-bootstrap-base { font-weight: bold; padding: 8px 15px 8px 14px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); background-color: #fcf8e3; border: 1px solid #fbeed5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: nowrap; padding-left: 25px; background-repeat: no-repeat; background-position: 3px 7px; } .notifyjs-bootstrap-error { color: #B94A48; background-color: #F2DEDE; border-color: #EED3D7; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY