Preview file¶
Read the preview contents of a temporary file or file within a connector.
POST $CLOUDSIGMA_API_BASE/connectors/file/preview
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. Prepare personal access token and target workspace ID that can access the target workspace. The temporary file is obtained from Upload connector file. The files within the connector obtain the connector ID and file URI from Query connector file list.
Request body¶
Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $CONN_FILE_ID in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/connectors/file/preview" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"conn_file_id\": \"$CONN_FILE_ID\",
\"rowStart\": 2,
\"columnNameRow\": 1,
\"isColumnName\": true
}"
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
The ID of the saved connector. |
|
string |
No |
The URI of the file within the connector. |
|
string |
No |
Temporary file ID to preview. |
|
string |
No |
The name of the worksheet to be read. |
|
boolean |
No |
Whether to use a column-name row. |
|
integer |
No |
The starting row of preview data. |
|
integer |
No |
Row number as column name. |
|
object or null |
No |
CSV parsing configuration. |
|
string |
When the object is provided |
Field separator. |
|
string |
When the object is provided |
The delimiter used to reference the field. |
|
boolean |
When the object is provided |
Whether backslash escaping is enabled. |
|
integer |
No |
File type code used for parsing. A value greater than |
CSV character configuration only takes the first byte and does not support multi-byte delimiter characters. When delimiter is empty, quote processing is turned off.
columnValues may be null, and sheets will not be returned when it is empty. The preview results may contain 21 records, but the maximum number is not guaranteed to be 20.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"conn_file_id": "conn_file_01",
"file_type": 25,
"rows": [
{
"number": 1,
"columnName": "id",
"columnValues": [
"1",
"2"
],
"charNumber": "",
"charColumnName": ""
}
],
"sheets": [
{
"name": "Sheet1",
"row_count": 2
}
]
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
Temporary file ID used for this preview. |
|
integer |
The actual file type code used for previewing. |
|
array of object |
Preview data organized by columns. |
|
integer |
number. |
|
string |
Column name. |
|
array of string or null |
List of column values. |
|
string |
Display number. |
|
string |
Display column names. |
|
array of object |
Spreadsheet worksheet. |
|
string |
Name. |
|
integer |
Number of rows. |
Error response¶
{
"code": "ErrIAMRequestInvalid",
"msg": "invalid parameter"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
error message. |