Query document details

Query the current snapshot and segment content of the source document for verification before editing segments.

HTTP
GET $CLOUDSIGMA_API_BASE/semantic-models/{model_id}/sources/{source_row_id}/document

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the knowledge base data source list to obtain the source record ID. Prepare a personal access token and target workspace ID that can access the target workspace.

Request parameters

Shell
curl "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/sources/$SOURCE_ROW_ID/document?page_size=20" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Shell
curl --get "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/sources/$SOURCE_ROW_ID/document" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  --data-urlencode "page_size=20" \
  --data-urlencode "cursor=$NEXT_CURSOR"

When editing a segment, use the data.etag returned by this interface to check whether the document has changed during modification.

Path parameters

Field

Type

Required

Description

model_id

integer

Yes

knowledge base ID.

source_row_id

string

Yes

Source record ID.

Query parameters

Field

Type

Required

Description

page_size

integer

No

The number of segments per page must be a positive integer. The default value is 20. When it exceeds 100, it is processed as 100.

cursor

string

No

data.segment_status.next_cursor returned from the previous page. The first query will not be sent.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "source": {
      "row_id": "src_01",
      "model_id": 401,
      "source_type": "file",
      "ingest_status": "ready"
    },
    "preview": {
      "available": true
    },
    "file_info": {
      "tags": ["product"],
      "enabled": true,
      "expires_at": null,
      "expired": false,
      "effective_enabled": true,
      "force_enabled_after_expiry": false
    },
    "segment_status": {
      "available": true,
      "total": 1
    },
    "etag": "<DOCUMENT_ETAG>",
    "segments": [
      {
        "segment_id": "seg_01",
        "level": "chunk",
        "content": "产品说明",
        "word_count": 4,
        "recall_count": 0,
        "enabled": true
      }
    ]
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

object

response data.

data.source

object

Source records.

data.preview

object

Source content preview.

data.file_info

object

File labels, expiration and activation information.

data.segment_status

object

Current segment availability status and quantity.

data.etag

string

The ETag of the current snapshot. Return when there is a value, fill in if_match when modifying the segment.

data.segments

array of object

This page segment of the current snapshot.

data.source.row_id

string

Source record ID.

data.source.source_id

string

Source ID. Returns if not empty.

data.source.source_type

string

Source type.

data.source.model_id

integer

Belonging knowledge base ID.

data.source.resource_id

string

Source resource ID.

data.source.source_resource_id

string

Original resource ID. Returned if there is a value.

data.source.kb_resource_id

string

Resource ID on the knowledge base side. Returned if there is a value.

data.source.source_file_id

string

Original file ID. Returned if there is a value.

data.source.kb_file_id

string

knowledge base file ID. Returned if there is a value.

data.source.source_table_id

integer

Original table ID. Returned if there is a value.

data.source.kb_table_id

integer

knowledge base table ID. Returned if there is a value.

data.source.display_name

string or null

Display name.

data.source.path

array of string

Source path.

data.source.source_path

string

Original source path. Returned if there is a value.

data.source.db_name

string or null

Database name.

data.source.table_name

string or null

Table name.

data.source.size_bytes

integer or null

File size.

data.source.row_count

integer or null

Number of table rows.

data.source.ingest_status

string or null

Processing status.

data.source.enabled

boolean or null

The enabled status of the configuration.

data.source.expires_at

integer or null

Expiration time.

data.source.expired

boolean

Has it expired?

data.source.effective_enabled

boolean

Current actual effective status.

data.source.force_enabled_after_expiry

boolean

Whether to force activation after expiration.

data.source.tags

array of string

Source tag. Returns if not empty.

data.source.created_by

string

Creator ID. Returned if there is a value.

data.source.updated_by

string

Last updated by ID. Returned if there is a value.

data.source.updated_at

integer or null

Last updated time.

data.source.error

string or null

Handle errors.

data.source.governance_status

string

Management status. Returns if not empty.

data.source.legacy_origin

string

Historical source markers. Returned if there is a value.

data.preview.available

boolean

Whether preview content is available.

data.preview.content

string

Preview content. Returned if there is a value.

data.preview.reason

string

Reason why preview is unavailable. Returned if there is a value.

data.file_info.tags

array of string or null

File label. When there is no label, it is null.

data.file_info.expires_at

integer or null

Expiration time.

data.file_info.enabled

boolean or null

The enabled status of the configuration.

data.file_info.expired

boolean

Has it expired?

data.file_info.effective_enabled

boolean

Current actual effective status.

data.file_info.force_enabled_after_expiry

boolean

Whether to force activation after expiration.

data.segment_status.available

boolean

Whether the segment is available.

data.segment_status.reason

string

Reason for unavailability. Returned if there is a value.

data.segment_status.total

integer

Number of segments.

data.segment_status.next_cursor

string

Next page cursor. Return when there are subsequent segments.

data.segments[].segment_id

string

Segment ID.

data.segments[].start_ms

integer

Starting time or location. Returned if there is a value.

data.segments[].end_ms

integer

End time or location. Returned if there is a value.

data.segments[].level

string

Segment level.

data.segments[].chunk_index

integer

Segment number. Returned if there is a value.

data.segments[].chunk_id

string

Block ID. Returned if there is a value.

data.segments[].content

string

Segmented content. Returned if there is a value.

data.segments[].ocr_text

string

OCR text. Returned if there is a value.

data.segments[].image_description

string

Image description. Returned if there is a value.

data.segments[].image_file_id

string

Image file ID. Returned if there is a value.

data.segments[].page_image_file_id

string

Page image file ID. Returned if there is a value.

data.segments[].word_count

integer

Number of Unicode characters combined for text, OCR text, and image descriptions, including delimiting newlines.

data.segments[].recall_count

integer

Number of recalls.

data.segments[].enabled

boolean

Whether segmentation is enabled.

data.segments[].metadata

object

Information about the source volume. Returned when volume_id is included, other information submitted during creation will not be returned completely.

Error response

JSON
{
  "code": "ErrNotFound",
  "msg": "Not Found"
}

Field

Type

Description

code

string

error code.

msg

string

Error description.

Last updated on