Welcome to the new Box Support website. Check out all the details here on what’s changed.

Representations availability

New post

Comments

5 comments

  • Peter Christensen

    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

    0
    Comment actions Permalink
  • Reinhard Holzner

    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?

    0
    Comment actions Permalink
  • Peter Christensen

    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

    0
    Comment actions Permalink
  • Reinhard Holzner

    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?

    0
    Comment actions Permalink
  • Peter Christensen

    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

     
    0
    Comment actions Permalink

Post is closed for comments.