Get User list example


This sample shows how to retrieve all company's drivers with the limiting filter set to only active drivers.
It is assumed that a valid api key is provided into the function.
Note that it is possible to retrieve just a subset of the user's attributes, which is dictated by defining resulting user class partially.


        public class User
            public string Id { get; set; }
            public string Email { get; set; }
            public string Name { get; set; }
            public bool ActiveLicense { get; set; }

        protected List<User> GetActiveDrivers(string apikey)
            List<User> activeUsers = new List<User>();

            var cli = new RestClient("");
            var request = new RestRequest("users", Method.GET);
            request.AddQueryParameter("excludeDispatchers", "true");
            request.AddHeader("X-api_key", apikey);
            request.RequestFormat = DataFormat.Json;
                var response = (RestResponse)cli.Execute(request);
                var jsonConverter = new RestSharp.Deserializers.JsonDeserializer();
                List<User> users = jsonConverter.Deserialize<List<User>>(response);
                for (int i = 0; i < users.Count; i++)
                    if (users[i].ActiveLicense == true)
            catch (Exception e)

            return activeUsers;

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request