import_json
To read data from a WLP file, use the exchange/import_json command.
svc=exchange/import_json¶ms={"eventHash":<text>}
This request can’t be executed simultaneously with any request from this chapter and the following requests:
- …/report/exec_report,
- …/report/export_result,
- …/report/get_result_chart,
- …/report/get_result_map,
- …/messages/load_interval,
- …/render/create_messages_layer,
- …/unit/get_trips,
- …/resource/get_driver_bindings,
- …/resource/get_trailer_bindings,
- …/account/get_account_history.
Parameters
You can include the optional parameter eventHash in the request. It allows specifying the event name which will be generated after reading the data.
Loading a file
To load a WLP file, use a POST request with multiple contents (multipart/form-data). For example:
Request URL: https://hst-api.wialon.com/wialon/ajax.html?svc=exchange/import_json&sid=8157df114c0e601f0f31091c3c2ac53d
Request Method: POST
Connection: keep-alive
Content-Length: 1901
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryhAXcAjtvh1D61XpC
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
------WebKitFormBoundaryhAXcAjtvh1D61XpC
Content-Disposition: form-data; name="params"
{"eventHash":"jUploadForm1372772377019"}
------WebKitFormBoundaryhAXcAjtvh1D61XpC
Content-Disposition: form-data; name="eventHash"
jUploadForm1372772377019
------WebKitFormBoundaryhAXcAjtvh1D61XpC
Content-Disposition: form-data; name="import_file"; filename="file.zip"
Content-Type: application/zip
------WebKitFormBoundaryhAXcAjtvh1D61XpC--
Response
If the request is completed successfully, an empty response is returned.
{ }
To be sure that data has been read, you can execute the …/requests/avl_evts command:
{
"tm":<uint>, /* current server time (UTC) */
"events":[
{
"i":-1,
"d":{ /* data */
"hash":<text>, /* upload complete */
files: { /* files uploaded */
<text>:<Object>, /* file name: file data */
...
}
}
}
]
}
If the request is not completed, an error code is returned.
Error codes
Code | Description |
---|---|
1 | Invalid or obsolete request SID. |
4 | No files attached. |
7 | Failed to obtain the current user. |