Login
To access TrackService API you must use a key. To get a key you must login. A key will be valid for 4 hours after last request. To get a key you can use XML or JSON format of request and response. Below shown both formats of request and response.
Use the followith URL template to get a key by specifying user name and password. Request type must be POST for both XML and JSON format.
http://trackservice.trackroad.com/rest/login
XML
To receive response in XML format you must specify content type text/xml or application/xml. For example:
...
httpWReq.Method = "POST";
httpWReq.ContentType = "text/xml; charset=utf-8";
httpWReq.ContentLength = data.Length;
...
XML request
<LoginSpecification>
<UserName>your_user_name</UserName>
<Password>your_password</Password>
</LoginSpecification>
XML response
<LoginResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Message>Success</Message>
<Status>Success</Status>
<Key>3f7cb822-ec14-484b-9c9e-40c6a8e68ee6</Key>
</LoginResult>
Operation status is success if login was successful and key will be returned. Otherwise key will be null.
A key will be valid for next 4 hours after last call. Use it in each call to TrackService.
JSON
To receive response in JSON format you must specify content type text/json or application/json. For example:
...
httpWReq.Method = "POST";
httpWReq.ContentType = "text/json; charset=utf-8";
httpWReq.ContentLength = data.Length;
...
JSON request
{
"UserName":"your_user_name",
"Password":"your_password"
}
JSON response
{
"Message":"Success",
"Status":1,
"Key":"3f7cb822-ec14-484b-9c9e-40c6a8e68ee6"
}
Operation status is success if login was successful and key will be returned. Otherwise key will be null.
A key will be valid for next 4 hours after last call. Use it in each call to TrackService.