write

To write text content into a file, use the file/write command:

Copied!
svc=file/write&params={
   "itemId":<long>,
   "storageType":<uint>,
   "path":<text>,
   "content":<text>,
   "writeType":<uint>,
   "contentType":<uint>
}

Parameters

ParameterDescription

itemId

Item ID.

storageType

Storage type:
 public (all users can see and download files),
 protected (only users with access rights can see and download files).

path

Relative path from the root folder to the file.

content

File content.

writeType

Write type:
0  overwrite the file,
1  append to the file content,
2  don't overwrite if the file exists.

contentType

Content type. The content can be returned as:
0 — text,
1 — hex string,
2 — base64 string.

Response

If the request is completed successfully, an empty response is returned.

Copied!
{} /* empty json */

Otherwise, an error code is returned.

Error codes

CodeDescription

1

User not authorized.

4

Invalid input parameters.

5

Failed to overwrite the file because a file with the  same name already exists and "writeType":2 is specified.

7

Insufficient rights to the item specified in the itemId parameter.

Download PDF file
Download Word document