Upload unit image

To upload an image for a unit, use the command unit/upload_image:

svc=unit/upload_image&params={"itemId":<long>,
			      "eventHash":<text>}

Parameters

Name Description
itemId unit ID
eventHash event name which will be generated after uploading the image (optional parameter)

To upload an image, use a POST request with multiple contents (multipart/form-data), where one part contains parameters and the other contains the image.

For example:

POST /wialon/ajax.html?svc=resource/upload_image&sid=<long> HTTP/1.1
Host: <host>
Connection: keep-alive
Content-Length: <uint>
Cache-Control: max-age=0
Content-Type: multipart/form-data; boundary=----k2vvQ6nvlallm1lk
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.3

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

{"itemId":<uint>,"eventHash":"UploadUnitImage"}
------k2vvQ6nvlallm1lk
Content-Disposition: form-data; name="upload_image"; filename="unit_image.jpg"
Content-Type: image/jpeg

<binary data image>
------k2vvQ6nvlallm1lk--

Response

{}	/* empty object if execution successful, if not - error code */
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam