Third party applications can use Thru View API to view files stored on Thru server in a browser by calling URL to Viewing API and supplying prepared parameters.
View API Tool displays an image file or the first page of pdf file in canvas element in browser and executes reporting redirects on success or failure.
View API is available via the following URL :
https://thruservername/APITool/1.0/View/<shortId> where shortID is prepared in advance by web service call
String GetViewerRequestKey(Guid sessionId, FTHViewerRequest request)
which will be specified below and represents the following data structure:
SessionId : Unique identifier of the current session.
FileId : ID of file for view obtained by previous web service calls.
SuccessUrl : Redirect to this URL if viewing is success.
ErrorReportingUrl : Redirect to this URL if viewing failed.
If viewing failed, a server returns server error code (see below) using parameter “ThruErrorCode”. If an error occurred and ErrorReportingUrl is not defined, then server throws unhandled exception.
Note: the value of ErrorReportingUrl is not validated. Please ensure this is a valid URL.
Reporting redirect rules:
Image successfully displayed: call to
<SuccessUrl> in iFrame, image is still displayed in a browser tab
Image cannot be displayed: redirect to
<ErrorReportingUrl> in the following format:
Server error codes
The codes below are passed as parameters to the ErrorReportingUrl in case any error occurs:
1 – SessionId is not a valid session id format. 2 – Unknown SessionId. Provided session identifier does not exist on server 3 – FileId is not valid FileId format 4 – FileId does not reference existing file 5 – FileId references to the file of a type not supported for viewing 6 – View failed. This error code is returned for any error that can’t be detected as other ErrorCode
File formats supported for viewing
image files: JPG, PNG, GIF and BMP are supported by all browsers, other image types are supported depending on browser ( see
Sample File View API URL:
Sample steps to work with View API
WDSL file for API version 4.0 is located at
Get session id:
Open() or OpenImmutable() or other Open* calls in Thru API
Get FileId for viewing by using one of the file browsing or search methods.
Provide SuccessUrl and ErrorReportingUrl and fill in the structure
ShortId=GetViewerRequestKey(Guid sessionId, FTHViewerRequest request)
Compose View URL and open browser window with the link: