Dear Anser,
Thank you. I changed and got the following response.
{"Type":"api_error","Message":"The request failed due to an internal error.","Code":"500","Params":[{"Name":"WINConnect.Manager","Message":"Object reference not set to an instance of an object."},{"Name":"","Message":"One or more errors occurred."}]}
The API document indicate the following format. Should I change the code?
Login and Authentication:
Calling the Login with POST method endpoint obtains an initial authToken as a cookie and creates your secure
session in the WIN application. Each API request will return a fresh authToken cookie which must be passed
back to WIN in the next API request. Cookies are short text strings which the user agent (usually your web
browser but may be an HTTP library in .NET, Java or PHP, or a command line utility such as curl) stores and
manages. The only request that does not need an initial authToken cookie value is the Login. Your application
must also set headers for Content-type: application/json and Accept: application/json in the Login POST
request.
Example of Login POST request:
POST
{ "Username": "user@company.com", "Password": "secret"}
Headers:
Content-Type: application/json
Accept: application/json
Example of Login POST response:
Headers:
Cache-Control:no-cache
Content-Encoding:gzip
Content-Length:806
Content-Type:application/json; charset=utf-8
Date:Tue, 16 Dec 2014 07:00:05 GMT
Expires:-1
Pragma:no-cache
Set-Cookie:authToken=C9F3440891B1456002C223785F2C43581A00369CE7B6021E3B00FA21618FEBC51F0483
1AD0717A4FF7EF29A0882A38B9940E9E238CFE965ABA1C581399CCA2A804D663A521023F7953D40CC19EF6C
7CED0086B6F5F8D3C7A4352111247988B4D6789876D34A526823AF18E8DC4EE44BD; expires=Tue,
23-Dec-2014 07:00:05 GMT; path=/api; HttpOnly
Vary:Accept-Encoding
Each new Set-Cookie:authToken value returned from WIN must be provided in the next GET request header as
shown below (see GET UAT API Endpoint).
Upon successful login an object containing information about the logged in user will also be returned. Your
application does not need to store or do anything with this information.
{"LastLogin": "2014-12-16T10:58:52.293529Z", "UserDetails": { "ContactID": 674, "AgentID": 184145,"FirstName": "UAT", "LastName": "APIUser", "Email": "UAT.apiuser@company.com", "JobTitle": "Software
Application", "ContactNumber": "+91889999999", "IsActivated": true, "OperatedBy": null, "Permissions":
["airtrackingapi" ]... }
↧