Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:local:remoteapi1504:codesamples:login [20/05/2014 11:49]
en:local:remoteapi1504:codesamples:login [20/05/2014 11:49] (current)
Line 1: Line 1:
 +{{indexmenu_n>​1}}
 +====== Login/​logout ======
  
 +To execute any command in Wialon, you need authorize and get session ID. 
 +
 +//:!: Attention!//​ To launch this example at Wialon Kit, change **<​nowiki>​https://​hst-api.wialon.com</​nowiki>​** for **<​nowiki>​https://​kit-api.wialon.com</​nowiki>​** in all requests and use user name and password of your account to login to the system or name and password of demo user //**kitdemo kitdemo**//​.
 +
 +===== Login =====
 +
 +To get authorized, make the request [[../​apiref/​core/​login|core/​login]]. In current example, we use demo login and password of **<​nowiki>​https://​hst-api.wialon.com</​nowiki>​**.
 +<​code>​
 +https://​hst-api.wialon.com/​wialon/​ajax.html?​svc=core/​login&​
 + params={
 + "​user":"​wialon_test",​
 + "​password":"​test"​
 + }
 +</​code>​
 +
 +Response:
 +<code javascript>​
 +{
 +    "​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",​
 +            ...           
 +        },
 +        "​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
 +    }
 +}
 +</​code>​
 +
 +For further operations, we need session ID which is specified in the field **eid**. In our case it is **d1cb60897768780f846df7ab2400eb5f**. ​
 +
 +===== Logout =====
 +
 +To stop working with Wialon and logout from the system, deactivate the session making the following request:
 +
 +<​code>​
 +https://​hst-api.wialon.com/​wialon/​ajax.html?​svc=core/​logout&​params={}&​sid=d1cb60897768780f846df7ab2400eb5f
 +</​code>​
 +
 +Response:
 +<code javascript>​
 +{
 + "​error":​0
 +}
 +</​code>​
 +
 +Such result tells us that the exit was successful.
 +
 +Parameters of this request as well as the returned value are described in the chapter [[../​apiref/​core/​logout]].
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam