Get File HTML5 Preview
/documents/api/1.2/files/{fileId}/previewPath
Generate an HTML5 preview of the given file and return a path that can be used to access it.
The types of files that can be previewed include (similar formats may also be supported):
- Most images (bmp,jpg,tif,gif,png)
- Office files (doc, docx, dot, dotx, xls, xlsx, xls, xlst, pot, potx, ppt, pptx)
- Text files (txt, scripts, source code)
- AutoCAD drawings
- Adobe PDF files
- Internet files (html, email)
Note that previews cannot be generated for video formats.
Request
- application/json
- application/xml
-
fileId: string
Globally unique identifier (GUID) for the file.
-
version(optional): string
Specify the version number of the file to use. If the version is not specified, the latest version is used.
-
waitForCompletePreview(optional): string
When true, this call will not return until the HTML5 preview has been created. Using this parameter will delay the return of this call but will ensure the preview is fully available to the system. The default is false.
-
accessToken(optional): string
Applink access token authorizing the current user to access the parent folder or this file. This parameter is mandatory if
appLinkID
is used. It can be used as accessToken or AccessToken. -
appLinkID(optional): string
Applink ID authorizing the current user to access the parent folder or this file. Any time the parameter
appLinkID
is used, a parameteraccessToken
must be provided as well. It can be used as appLinkID or AppLinkID. -
dAccessCode(optional): string
Access code needed to use protected public links. It needs to be sent as part of a Cookie header in the following format:
dAccessCode-<linkID>=<passcodeValue>
-
linkID(optional): string
Public link ID of a public link authorizing the current user to access this file. It can be used as linkID or LinkID.
Response
- application/json
- application/xml
200 Response
The request was fulfilled.
object
-
errorCode(optional):
number
An error code of zero (0) indicates no errors.
-
id(optional):
string
Globally unique identifier (GUID) for the file.
-
previewUrl(optional):
string
HTML5 preview path.
-
type(optional):
string
Item type
file
. -
version(optional):
string
File version.
{
"errorCode":"0",
"id":"D3C1C1F319CFE6B102095C5DT0000000000100000001",
"previewUrl":"http://Service1-AttTenant1.slc04ymr.us.oracle.com:12020/documents/fileview/D03175B85C8EAA3B6F2BC6A84EE870070A1A2B7FEACF/1/preview/html5/pvw.html",
"version":"1",
"type":"file"
}
403 Response
Forbidden if the user does not have read permission.
404 Response
File ID is not found.
Examples
The following example generates an HTML5 preview of this file and also provides a path to access it.
GET .../files/D03175B85C8EAA3B6F2BC6A84EE870070A1A2B7FEACF/previewPath?version=1
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "errorCode": "0", "id": "D03175B85C8EAA3B6F2BC6A84EE870070A1A2B7FEACF", "previewUrl": "http://Service1-AttTenant1.slc04ymr.us.oracle.com:12020/documents/fileview/D03175B85C8EAA3B6F2BC6A84EE870070A1A2B7FEACF/1/preview/html5/pvw.html", "type": "file", "version": "1" }
Example 2
The following example shows an error message when an HTML5 preview was not generated.
GET .../files/D512601281A52376A28F2D4CB5D17B95F47087F4E518/previewPath?version=1
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 404
JSON Response
{ "errorCode": "-16", "errorKey": "!csUnableToGetDynamicConversionNew!csGeneratePreviewFailed", "errorMessage": "Unable to get dynamic conversion. Unable to generate preview images, no images created.", "errorType": "file", "id": "D512601281A52376A28F2D4CB5D17B95F47087F4E518", "title": "Unable to get dynamic conversion. Unable to generate preview images, no images created.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 3
The following example generates an HTML5 preview of this file and also provides a path to access it. The example uses an applink ID because this file is under a folder structure not owned by or shared with the current user. The applink ID and access token are submitted in the request header.
GET .../files/D110149C6BF6EF07A968CB78B5D17B95F47087F4E518/previewPath?version=1
Request Header
appLinkID: LF5Bxj4TPo_p4n4qWn0tbKTicR2cTUJKv7X_ng9E7ry93rRuDokPqS1d6-wKwhb_wtcGYFDsI_cNMxeKQ-HR-FXQhiVoGRTYM_MPZY8qpICfYU94mmnMjM_cvsRhKMzc0NJgvwEJfqqDwPsAVrhc8cmg== accessToken: 352FpiMmW66PeYI1Gh5b83I9CXRwZhLfYAu4TXdqpzD8uNKUBMZVVJ3ZvivUW8kQ
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "errorCode": "0", "id": "D110149C6BF6EF07A968CB78B5D17B95F47087F4E518", "previewUrl": "http://service1-tenant2.myhost:19200/documents/link/app/fileview/LFCgbdYuDTDluTeDWFECI5Szz1C30tvWtOEgJYKv7C7rxZ2RUwfR8c-oTx-op_59W3mqF4l2Q852N25LdR8fy0A6J_Fw6XzirkJngtnspCuQoPYdtjBmwzCEym0ZQd2DpQ1pevDZ948RB7-pJN0JnIHg==/FnQ9vtFfq5aKFTR4P-T9ry3uJdJi9n9LBiPOXgOkTkRoQXqfmGHJMR2DGcbRGA5kUm00SXWPui8h__0yk6qybA==/D110149C6BF6EF07A968CB78B5D17B95F47087F4E518/1/preview/html5/pvw.html", "type": "file", "version": "1" }