Query file list

Lists files accessible to a connector. First get the file uri from the response and then preview the file.

HTTP
GET $CLOUDSIGMA_API_BASE/connectors/files/list

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, target workspace ID and connector ID that can access the target workspace. Only connectors that support file enumeration can call this interface.

Request parameters

Replace $CONNECTOR_ID, $CLOUDSIGMA_API_KEY, $WORKSPACE_ID in the example with actual values.

Shell
curl "$CLOUDSIGMA_API_BASE/connectors/files/list?connector_id=$CONNECTOR_ID&limit=20" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Parameter

Type

Required

Description

connector_id

string

Yes

The connector ID to read the file from.

cursor

string

No

Only fill in when data.has_more on the previous page is true. Fill in the data.cursor returned on the previous page, in the example it is $NEXT_CURSOR.

limit

integer

No

This page returns the quantity.

dir

string

No

A directory relative to the connector configuration root. Fill in the relative path, do not start with /.

file_types

integer (integer array)

No

Common file type code to filter on.

S3 and OSS use cursor paging. HDFS ignores limit, cursor and returns the full directory. Browsing Local connections is not currently supported.

Ordinary files are filtered by conditions after paging, and directories are always retained and ranked after ordinary files. Therefore, when there is no file on the current page, there may be a next page.

file type code

Basics and Documentation

0
Unrecognized
1
TXT
2
PDF
4
PPT
5
Word
6
Markdown
9
SQL
10
Directory
11
DOCX
12
PPTX
35
DOC

Structured data

7
CSV
8
Parquet
24
XLS
25
XLSX

Images

3
Generic image
20
PNG
21
JPG
22
JPEG
23
BMP

Audio and video

13
WAV
14
MP3
15
AAC
16
FLAC
17
MP4
18
MOV
19
MKV

Web pages and email

27
HTM
28
HTML
29
EML
30
MSG
31
P7S

CAD and compressed package

32
DWG
33
DXF
34
FAS
101
ZIP
102
RAR
103
7Z
104
TAR
105
TAR.GZ
106
TAR.BZ2
107
GZ
108
BZ2

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "files": [
      {
        "uri": "/orders.csv",
        "filename": "orders.csv",
        "size": 1024,
        "type": 1,
        "path": "/",
        "create_time": 0,
        "update_time": 0
      }
    ],
    "cursor": "next_cursor",
    "has_more": true
  }
}

Field

Type

Description

data.files

array of object

Current page file.

data.files[].uri

string

File URI.

data.files[].filename

string

File name.

data.files[].size

integer

size in bytes.

data.files[].type

integer

type.

data.files[].path

string

path.

data.files[].create_time

integer

Creation time.

data.files[].update_time

integer

Update time.

data.cursor

string

Next page cursor.

data.has_more

boolean

Whether another page exists.

Error response

JSON
{
  "code": "ErrServer",
  "msg": "server error"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on