Table of Contents

Put files

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

Parameters

Parameter Description
itemId element 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
writeType write type:
0 - overwrite a file,
1 - append to a file content,
2 - do not overwrite if file exists
eventHash event name which will be generated af-
ter processing the data

:!: There is no way for 'file' and 'folder' to coexist with the same names (e.g. text file 'readme' and 'readme'-folder) because Linux treats them as the same entity though with different attributes.

In order to upload some files, put them using POST-request with some params (multipart/form-data), e.g.:

Request URL: https://hst-api.wialon.com/wialon/ajax.html?svc=file/put&sid=<sid>
Request Method: POST
Connection: keep-alive
Content-Length:333998
Cache-Control:max-age=0
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryMpLUirMexsfCGaJP
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.3
Accept-Encoding: gzip,deflate,sdch
Accept-Language: ru,en-US;q=0.8,en;q=0.6


------WebKitFormBoundaryhJ0ZukEcpN7MgFnC
Content-Disposition: form-data; name="params"

{"itemId":439,"storageType":"1","path":"1","writeType":0,"eventHash":"jUploadForm1414572405484"}
------WebKitFormBoundaryhJ0ZukEcpN7MgFnC
Content-Disposition: form-data; name="eventHash"

jUploadForm1414572405484
------WebKitFormBoundaryhJ0ZukEcpN7MgFnC
Content-Disposition: form-data; name="f"; filename="one-file"
Content-Type: application/octet-stream


------WebKitFormBoundaryhJ0ZukEcpN7MgFnC--

Response

{
	"<filename>":"<result>",	/* <filename> - uploaded file name */
					/* <result> - request result; 0 - failed, 1 - OK */
	...
}
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2021 Gurtam