upload_image

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

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

Parameters

The request can contain the following parameters. The required parameters are marked with an asterisk (*).

Parameter Description
itemId* Unit ID.
eventHash Event name which will be generated after uploading the image.

Uploading the image

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

Copied!
Request URL: https://hst-api.wialon.com/wialon/ajax.html?svc=unit/upload_image&sid=8157df114c0e601f0f31091c3c2ac53d
Request Method: POST
Host: hst-api.wialon.com
Connection: keep-alive
Content-Length: 31720
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryECovXn5tfw5muHk8
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
 
------WebKitFormBoundaryECovXn5tfw5muHk8
Content-Disposition: form-data; name="params"
 
{"itemId":911903,"eventHash":"jUploadForm1372769354768"}
------WebKitFormBoundaryECovXn5tfw5muHk8
Content-Disposition: form-data; name="eventHash"
 
jUploadForm1372769354768
------WebKitFormBoundaryECovXn5tfw5muHk8
Content-Disposition: form-data; name="icon_file"; filename="image.jpg"
Content-Type: image/jpeg
 
 
------WebKitFormBoundaryECovXn5tfw5muHk8--

Response

If the request is completed successfully, an empty object is returned:

Copied!
{}

To make sure the image has been uploaded, use the requests/avl_evts method.

If the request fails, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters.
6 Failed to save the image.
7 No AADF_ACL_ITEM_EDIT_IMAGE access right to the unit.

If you find a mistake in the text, please select it and press Ctrl+Enter.

Report a mistake

Your message was sent. Thank you!

An error occurred while submitting the form

Download PDF file
Download Word document

See also