At Ruffian Software, Inc. we are developers and we love to see our product and community grow….alright enough with the niceties….to the code! This code is available under the MIT License.
TechIDManager has a REST API to allow you to do more with TechIDManager, and customize it to your will. This example shows how to get the data from the activity report. Documentation is available at https://chdoc.ruffiansoftware.com/swagger . If you have any questions, just let us know.
Important things about this C# example:
- The API Key and IP address need to be setup in the Management Console.
- The manager used to run this must be a real manager. We suggest you setup a specific manager for API interaction stuff.
If you have any questions, email Support@TechIDManager.com
namespace ActivityReport { public class Program { public class ActivityLogReport { public string Status { get; set; } = ""; public DateTime CentralHostDateTime { get; set; } = DateTime.MinValue; public string User { get; set; } = ""; public string IPAddress { get; set; } = ""; public string StatusType { get; set; } = ""; public string HumanReadable { get; set; } = ""; public override string ToString() { return $"{CentralHostDateTime} -> {Status}"; } } static async Task Main(string[] args) { // this is TERRIBLE command line parsing, but command line parsing is not the point of this example. // https://ch100.ruffiansoftware.com/ string host = args[0]; // this API key is specific to an IPAddress it it important to store this API key somewhere safe. // the use of commandline is just for example, we suggest you keep it somewhere safer than a scipt file. string apikey = args[1]; string email = args[2]; System.Collections.Specialized.NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(string.Empty); // The user we want any changes logged as // must be a valid manager nvc.Add("Email", email); nvc.Add("authenticationmethod", "local"); // parameters for the report (note there is a 14 day limit on the date range) nvc.Add("StartDateTime", DateTime.Now.AddDays(-1).ToString()); nvc.Add("EndDateTime", DateTime.Now.ToString()); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "APIKey " + apikey); string full_address = $"{host}/client/report/activitylog?{nvc}"; Console.WriteLine(full_address); HttpResponseMessage response = await client.GetAsync(full_address); if(!response.IsSuccessStatusCode) { Console.WriteLine($"{response.StatusCode} ({response.StatusCode.ToString()}) : {response.ReasonPhrase}"); return; } string t = await response.Content.ReadAsStringAsync(); Console.WriteLine($"StatusCode = {response.StatusCode}"); Console.WriteLine($"Result = {t}"); List data = System.Text.Json.JsonSerializer.Deserialize< List>(t); foreach (ActivityLogReport item in data) { Console.WriteLine(item); } } } }
Transparency Note: An AI/LLM was used in the formatting of this content. An AI/LLM was NOT used in the generation of the content or code.