Write to a file

You may write text content into a file using file/write :

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

Params

Parameter Description
itemId item id
storageType storage type:
1 – public (all users may see/download
files ),
2 – protected (that users may see/down-
load files who being grant rights)
path relative path from root folder to the file included
content content being written
writeType write type:
0 – rewrite a file,
1 – append to a file,
2 – do not rewrite if the file exists
contentType content type; the content is returned as:
0 – text,
1 – hex string,
2 – base64 string

Response

After write success:

{}

Errors

{
    "error":<uint>					/* error code */
}
Error code Description
1 you are not authorized
3 file not found
4 wrong id inputted (not digits)
5 file already exists (if ‘do not rewrite existed file’ option chosen)
7 ‘id’ not found