检索文档内容

Retrieve contents of a document by its ID.

get

Returns the content of the document with the specified ID, along with the index of the latest retrieved chunk. Each call fetches up to 20 chunks. To get more, use the end_chunk value from the response as the start_chunk for the next call.

Path parameters
document_idintegerRequired

The ID of the document to retrieve contents for.

Query parameters
start_chunkintegerOptional

Indicate the starting chunk that you want to retrieve. If not specified, the default value is 0.

end_chunkintegerOptional

Indicate the ending chunk that you want to retrieve. If not specified, the default value is start_chunk + 20.

Responses
200
Content of the document and index of the latest retrieved chunk.
application/json
get
GET /api/v1/documents/{document_id}/contents/ HTTP/1.1
Host: api.rememberizer.ai
Accept: */*
{
  "content": "text",
  "end_chunk": 20
}

示例请求

curl -X GET \
  "https://api.rememberizer.ai/api/v1/documents/12345/contents/?start_chunk=0&end_chunk=20" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

YOUR_JWT_TOKEN 替换为您的实际 JWT 令牌,将 12345 替换为实际的文档 ID。

路径参数

参数
类型
描述

document_id

整数

必填。 要检索内容的文档ID。

查询参数

参数
类型
描述

start_chunk

整数

起始块索引。默认值为 0。

end_chunk

整数

结束块索引。默认值为 start_chunk + 20。

响应格式

{
  "content": "文档块的完整文本内容...",
  "end_chunk": 20
}

错误响应

状态码
描述

404

文档未找到

500

服务器内部错误

大型文档的分页

对于大型文档,内容被分成多个块。您可以通过多次请求来检索完整文档:

  1. 先发起一个请求,使用 start_chunk=0

  2. 将返回的 end_chunk 值作为下一个请求的 start_chunk

  3. 继续直到您检索到所有块

此端点返回文档的原始文本内容,使您能够访问完整信息以进行详细处理或分析。

Last updated