In-Process API not returning User join date and last visited date.

Trying to fetch the user information using In-process API. The APIs not returning the user "join date" and "last visited date". 

Is any configuration to access those fields in API?

Thanks

Vignesh D

Parents
No Data
Reply
  • We are not disabled any plugins.

    Yes API user in Administrator role and user have Read user profiles permissions.

    We are validating oauth token using "/api.ashx/v2/info.json" this api services. Before hitting the in-process api

    Private void ProcessRequest(HttpContext context)
    {
    var token = context.Request.Headers["Authorization"];
                var apiUrl = ConfigurationManager.AppSettings["webApiUrl"];
                IEventLog eventLog = Telligent.Evolution.Extensibility.Apis.Get<IEventLog>();
                eventLog.Write("Before token validate", new EventLogEntryWriteOptions());
    
                if (token != null && IsTokenAuthenticated(token, apiUrl))
                {
                    eventLog.Write("after token validate", new EventLogEntryWriteOptions());
                    var userAPI = Telligent.Evolution.Extensibility.Apis.Get<IUsers>();
                    var value = userAPI.Get(new UsersGetOptions { Username = "UserOne" });
                    UsersListOptions options = new UsersListOptions();
                    options.PageSize = userAPI.List().TotalCount;
                    var rolelist = roles.List();
                    UserResponse userResponse = new UserResponse();
                    userResponse.TotalRecords = options.PageSize.Value;
                    userResponse.PageNo = context.Request.QueryString["pageNo"] != null ? Convert.ToInt32(context.Request.QueryString["pageNo"]) : 1;
                    userResponse.PageSize = context.Request.QueryString["pageSize"] != null ? Convert.ToInt32(context.Request.QueryString["pageSize"]) : 10000;
                    eventLog.Write("Before consume user api", new EventLogEntryWriteOptions());
                    var userList = userAPI.List(options).ToList();
                    }
    }
    private bool IsTokenAuthenticated(string token, string apiUrl)
        {
            var oauthKey = String.Format("{0} {1}", "OAuth", token.ToString());
            var restRequest = WebRequest.Create(apiUrl + "/api.ashx/v2/info.json") as HttpWebRequest;
            restRequest.Method = "Get";
            restRequest.Headers.Add("Authorization", oauthKey);
            string restResponse = null;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            using (var webRESTResponse = (HttpWebResponse)restRequest.GetResponse())
            {
                var stream = webRESTResponse.GetResponseStream();
                if (stream != null)
                {
                    using (var reader = new StreamReader(stream))
                    {
                        restResponse = reader.ReadToEnd();
                    }
                }
            }
    
            return restResponse != null ? true : false;
        }
    .

Children