Skip to main content
Question

Representations availability

  • May 22, 2025
  • 5 replies
  • 23 views

Forum|alt.badge.img

Hello,

we are using the Box API to download representations of files uploaded to Box. We noticed that upon upload of a new PPTX file, the preview thumbnail was not yet present in the representations list. After some time, the thumbnail was there.

It seems the thumbnail has not yet been generated at the beginning. Is that right? When are the thumbnails for PPTX generated? Upon uploading, or upon first viewing the file?

Also: is there some event or logic that tells us that the representations are now ready? How can we differ between the case a) thumbnails are not there because not supported and b) thumbnails are not there because they have not yet been generated.

Thank you!

5 replies

Forum|alt.badge.img

Hi Reinhard

Please see the guide here that mentions Asynchronous Thumbnail creation https://developer.box.com/guides/representations/thumbnail/#asynchronous-thumbnail-creation

Also looks at the response section on the endpoint documentation: https://developer.box.com/reference/get-files-id-thumbnail-id#response

Specifically 

202: Sometimes generating a thumbnail can take a few seconds. In these situations the API returns a Location-header pointing to a placeholder graphic for this file type.

The placeholder graphic can be used in a user interface until the thumbnail generation has completed. The Retry-After-header indicates when to the thumbnail will be ready. At that time, retry this endpoint to retrieve the thumbnail.

302: Returns an error when Box is not able to create a thumbnail for this file type.

Instead, a Location-header pointing to a placeholder graphic for this file type will be returned.

Best regards,

Peter Christensen, Platform Solutions Engineer, Box


Forum|alt.badge.img

Hello thanks for the feedback. The problem is happening earlier. The representation does not show up at all in the representations list. So we do not even try to query the representation content because we do not see one is available. Can you please advise?


Forum|alt.badge.img

Hi 

I think the thumbnail API is actually deprecated but you can achieve the same with the representations API

https://developer.box.com/guides/representations/thumbnail-representation/#the-process should explain but process is the same. If you get a location header back and a retry-after header you can display the temporary image and try again after the retry-header specified time.

Peter


Forum|alt.badge.img

Hm thats really a problem. We need to check upfront which representations are available for an asset, and querying binary content for all different possible representations that could occur would be a performance nightmare. Is there no better way?


Forum|alt.badge.img

I understand. There is no event or similar emitted from box when the thumbnail is ready. As this is an asynchronous process we cannot guarantee when the thumbnail is ready so you will have to use some kind of polling mechanism. 

If you use eg our Node SDK you can see that there is some logic built in to wait for the thumbnail to be ready 
https://github.com/box/box-node-sdk/blob/main/src/managers/files.ts#L122