File Resources

Note: This page has not yet been converted to the new developer portal format. Please use Swagger to test this API.

File Resources

File Resources API is used to
manage documents within an organization.

GET /cm/v1/fileResources

Description

Return a paged set of documents.

Parameters

ParameterPositionTypeOptionalDescription

organizationId

header

Long

n

The ID of the organization.

Authorization

header

String

n

Basic authorization header.

id

url path

String

n

The ID of the task.

filtered

url parameter

String

y

Like filter-The filter value, in this case, the content of the documents.

containUsedNo

url parameter

boolean

y

If the attachment file is used. Default value: false.

folderIds

url parameter

Array[String]

y

In filter-The IDs of the folders that contain these documents.

columnName

url parameter

String

y

The name of the column to sort by, allowable values: “lastModifiedDate”.
“lastModifiedDate” will be used as default if this field is absent.

orderDirection

url parameter

String

y

The sort order of the data, allowable values: “ASC, DESC”.
“DESC” will be used as default if this field is absent..

pageNumber

url parameter

Integer

y

The page number of the data to return.
1 will be used as default if this field is absent.

pageSize

url parameter

Integer

y

The page size of the data to return.
25 will be used as default if this field is absent.

Response

HTTP Status CodeResponse Body

200Ok

{
"pageSize": 3,
"start": 0,
"data": [
{
"id": "5f8d5e70050cfb0001cdbab6",
"name": "s1.jpg",
"createdName": "lingxiao jin",
"createdId": 281754149584903,
"createdDate": 1603100272655,
"lastModifiedName": "lingxiao jin",
"lastModifiedId": 281754149584903,
"lastModifiedDate": 1606699425565,
"organizationId": 1328214341320748,
"folderId": "0",
"enableNotification": true,
"metadata": {
"OriginalFileName": "s1.jpg",
"ContentType": "image/jpeg",
"ContentLength": 87414
},
"fileId": "5f8d5e70050cfb0001cdbab6",
"documentType": "File"
},
{
"id": "5fab833e31276b6d5457c4b1",
"name": "testLog1",
"createdName": "lingxiao jin",
"createdId": 281754149584903,
"createdDate": 1605075774814,
"lastModifiedName": "lingxiao jin",
"lastModifiedId": 281754149584903,
"lastModifiedDate": 1605075774814,
"organizationId": 1328214341320748,
"folderId": "0",
"enableNotification": true,
"metadata": {
"OriginalFileName": "123231 (1).pdf",
"ContentType": "application/pdf",
"ContentLength": 25908
},
"fileId": "5fab833e31276b6d5457c4b1",
"documentType": "File"
},
{
"id": "5f9b6d7a170faa00016c01a0",
"name": "testLog",
"createdName": "lingxiao jin",
"createdId": 281754149584903,
"createdDate": 1604021626570,
"lastModifiedName": "lingxiao jin",

"lastModifiedId": 281754149584903,
"lastModifiedDate": 1604021626570,
"organizationId": 1328214341320748,
"folderId": "0",
"enableNotification": true,
"metadata": {
"OriginalFileName": "storeFiles-10-20.csv",
"ContentType": "application/octet-stream",
"ContentLength": 1676962
},
"fileId": "5f9b6d7a170faa00016c01a0",
"documentType": "File"
}
],
"totalCount": 7,
"totalPageCount": 3,
"currentPageNo": 1
}

400

Bad Request

401

Unauthorized

403

Forbidden. No Permission for this Resource

404

Resource Not Found

406

Not Acceptable. Illegal Input.

500

Internal Error

GET /cm/v1/fileResources/{id}/presignedUrl

Description

Get a “file” type document download URL (expires in 2 minutes).

Parameters

ParameterPositionTypeOptionalDescription

organizationId

header

Long

n

The ID of the organization.

Authorization

header

String

n

Basic authorization header.

id

url path

String

n

The ID of the document.

Response

HTTP Status CodeResponse Body

200Ok

The temporary download URL of the file, expires in 2 minutes.

400

Bad Request

401

Unauthorized

403

Forbidden. No Permission for this Resource

404

Resource Not Found

406

Not Acceptable. Illegal Input.

500

Internal Error

POST /cm/v1/fileResources

Description

Create a document.

Parameters

ParameterPositionTypeOptionalDescription

organizationId

header

Long

n

The ID of the organization.

Authorization

header

String

n

Basic authorization header.

fileType

url parameter

String

n

Type of the file (File, Link).

fileLink

url parameter

String

y

The link of the file when file type is “Link”.

file

body

Multi-part file

y

The multi-part form data of the file when the file type is “File”.

fileName

url parameter

String

n

The name of the file.

folderId

url parameter

String

y

The ID of the folder to which the document uploads. Default value: “0”, uncategorized.
See folder API for details.

Request Body

Multi-part file upload body (form data).

Response

HTTP Status CodeResponse Body

200Ok

The ID of the successfully created document.

400

Bad Request

401

Unauthorized

403

Forbidden. No Permission for this Resource

404

Resource Not Found

406

Not Acceptable. Illegal Input.

500

Internal Error

POST /cm/v1/fileResources/{id}

Description

Update a document.

Parameters

ParameterPositionTypeOptionalDescription

organizationId

header

Long

n

The ID of the organization.

Authorization

header

String

n

Basic authorization header.

fileLink

url parameter

String

y

The link of the file when file type is “Link”.

file

body

Multi-part file

y

The multi-part form data of the file when the file type is “File”.

fileName

url parameter

String

y

The name of the file.

id

url path

String

n

The ID of the document.

Request Body

Multi-part file upload body (form data).

Response

HTTP Status CodeResponse Body

200Ok

The ID of the successfully created document.

400

Bad Request

401

Unauthorized

403

Forbidden. No Permission for this Resource

404

Resource Not Found

406

Not Acceptable. Illegal Input.

500

Internal Error

PUT /cm/v1/fileResources/move/{folderId}

Description

Move the documents from one folder to another folder.

Parameters

ParameterPositionTypeOptionalDescription

organizationId

header

Long

n

The ID of the organization.

Authorization

header

String

n

Basic authorization header.

folderId

url path

String

n

The target folder ID.

documentIds

body

Object

n

The IDs of the documents.

Request Body

Post Batch - Request Body

Response

HTTP Status CodeResponse Body

200Ok

The ID of the successfully created document.

400

Bad Request

401

Unauthorized

403

Forbidden. No Permission for this Resource

404

Resource Not Found

406

Not Acceptable. Illegal Input.

500

Internal Error