To execute any command in Wialon, you need authorize and get session ID.
Attention! To launch this example at Wialon Kit, change https://hst-api.wialon.com for https://kit-api.wialon.com in all requests.
To get authorized, make the request token/login. In current example, we use token for authorization on https://hst-api.wialon.com.
https://hst-api.wialon.com/wialon/ajax.html?svc=token/login& params={ "token":"2fe8024e0ab91aa6c8ed82717b71bddcECDC362358DF7D90986F5173D405CD0D42DE7B38", "operateAs":"sdk_test" }
Response:
{ "host": "212.98.173.107", "eid": "d1cb60897768780f846df7ab2400eb5f", "tm": 1358415984, "user": { "nm": "wialon_test", "cls": 1, "id": 50935, "prp": { "addr_provider": "map_visicom", "cfmt": "0", "city": "Mexico", "dst": "-1", "fpnl": "monitoring", "language": "ru", "show_log": "0", "tz": "134232128", "user_settings_hotkeys": "1", ... }, "token": "{"app":"Wialon Hosting","ct":1443682655,"at":1443682655,"dur":2592000,"fl":-1,"p":"{}","items":[]}", "th": "2fe8024e0ab91aa6c8ed82717b71bddcECDC362358DF7D90986F5173D405CD0D42DE7B38", "crt": 0, "bact": 50936, "fl": 6, "hm": "", "uacl": 2097795 }, "classes": { "avl_hw": 4, "avl_resource": 3, "avl_retranslator": 7, "avl_route": 6, "avl_unit": 2, "avl_unit_group": 5, "user": 1 }, "features": { "unlim": 1, "svcs": { ... } } }
For further operations, we need session ID which is specified in the field eid. In our case it is d1cb60897768780f846df7ab2400eb5f.
To stop working with Wialon and logout from the system, deactivate the session making the following request:
https://hst-api.wialon.com/wialon/ajax.html?svc=core/logout¶ms={}&sid=d1cb60897768780f846df7ab2400eb5f
Response:
{ "error":0 }
Such result tells us that the exit was successful.
Parameters of this request as well as the returned value are described in the chapter Logout.