Skip to main content

PreviewDocument

Preview documents. Retrieve document download links, types, and titles. Use this operation to preview documents.

Operation description

Prerequisites
  • Alibaba Cloud Model Studio and Tongyi Gold services are activated.
  • Obtain the workspaceId: Obtain the workspace identifier.

Try it now

You can directly run this API in OpenAPI Explorer, which saves you the trouble of calculating signatures. After the operation succeeds, OpenAPI Explorer can automatically generate SDK code examples. Debug

RAM authorization

The following table describes the authorization information of the API. You can use it in the Action element of a RAM policy statement to grant RAM users or RAM roles the permission to call this API. For more information, see the following descriptions:
  • Action: the specific permission point.
  • Access level: the access level of each action. Valid values: Write, Read, and List.
  • Resource type: the resource types that support authorization for the operation. For more information, see the following descriptions:
    • For required resource types, an asterisk (*) is added before them.
    • For operations that do not support resource-level authorization, All Resources is displayed.
  • Condition key: the condition keys defined by the cloud service itself.
  • Dependent action: other permissions required to successfully perform the operation. The caller must have the permissions of all dependent actions before the operation can succeed.
ActionAccess levelResource typeCondition keyDependent action
dianjin:PreviewDocumentget
*All resources
*
    None
None

Request syntax

GET /{workspaceId}/api/library/document/preview HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample value
workspaceIdstringYes

Path parameter, workspace ID.

llm-xxxxx
documentIdstringYes

Document ID.

8326472354762354

Response elements

ElementTypeDescriptionExample value
object

ResultCode

costlong

Time consumed.

null
dataobject

Returned data.

previewTypestring

Preview type.

pdf
titlestring

Document title.

test
uploadTimestring

Upload time.

2024-01-01 00:00:00
urlstring

Document URL.

https://agi.alicdn.com/user/d0o/d3c1f50d-a6c2-49b3-b0c8-3e613c3f20ee_16872_3236784461.png
dataTypestring

Data type.

null
errCodestring

Error code.

0
messagestring

Error message.

ok
requestIdstring

Request ID.

ff551395-1c8a-4f30-8ffd-ef7e87c70b4c
successboolean

Indicates whether the request is successful.

true
timestring

Time.

2024-04-24 11:54:34

Examples

Success response JSON format
{
  "cost": 0,
  "data": {
    "previewType": "pdf",
    "title": "test",
    "uploadTime": "2024-01-01 00:00:00",
    "url": "https://agi.alicdn.com/user/d0o/d3c1f50d-a6c2-49b3-b0c8-3e613c3f20ee_16872_3236784461.png"
  },
  "dataType": null,
  "errCode": 0,
  "message": "ok",
  "requestId": "ff551395-1c8a-4f30-8ffd-ef7e87c70b4c",
  "success": true,
  "time": "2024-04-24 11:54:34"
}

Error codes

Visit the Error Center to view more error codes.