Method | Request URI |
---|---|
post | /API/LogOn/Token/ |
Response Code | Description |
---|---|
200 | The operation completed successfully. |
400 | The request contained one or more invalid parameters. |
This example will get a logon token for local user1 who has a password of "1234".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | using System.Net; using System.Net.Http; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Web.Script.Serialization; ... using (HttpClient httpClient = new HttpClient()) { // Define the request body HttpContent requestBody = null ; requestBody = new StringContent( @" { ""accountName"": ""user1"", ""password"": ""1234"", ""isWindowsLogOn"": false } " ,Encoding.UTF8,"application/json"); using (var response = httpClient.PostAsync(url, requestBody).Result) { if (response.StatusCode == HttpStatusCode.OK) { Console.WriteLine( "Success" ); // A Dundas.BI.WebApi.Models // GetLogOnTokenResultData object as a JSON // string. string jsonObject = response.Content.ReadAsStringAsync().Result; } } } |
This example will get a logon token for local user1 from a privileged service account with username adminsvc and password 4321.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | using System.Net; using System.Net.Http; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Web.Script.Serialization; ... using (HttpClient httpClient = new HttpClient()) { // Define the request body HttpContent requestBody = null ; requestBody = new StringContent( @" { ""effectiveAccountName"": ""user1"", ""accountName"": ""adminsvc"", ""password"": ""4321"", ""isWindowsLogOn"": false } " ,Encoding.UTF8,"application/json"); using (var response = httpClient.PostAsync(url, requestBody).Result) { if (response.StatusCode == HttpStatusCode.OK) { Console.WriteLine( "Success" ); // A Dundas.BI.WebApi.Models // GetLogOnTokenResultData object as a JSON // string. string jsonObject = response.Content.ReadAsStringAsync().Result; } } } |