Beispiel #1
0
        public Dictionary <String, Object> GetBulkGeolocation(GeolocationParams geolocationParams)
        {
            Dictionary <String, Object> json = new Dictionary <String, Object>();

            json.Add("ips", geolocationParams.GetIPAddresses());

            String         jsonStr     = JsonConvert.SerializeObject(json);
            String         urlParams   = BuildGeolocationUrlParams(geolocationParams);
            String         url         = "https://api.ipgeolocation.io/ipgeo-bulk" + "?" + urlParams;
            List <JObject> apiResponse = GetBulkApiResponse(jsonStr, url);

            return(prepareBulkResponseForUser(apiResponse, "geolocation"));
        }
Beispiel #2
0
        public List <Geolocation> GetBulkGeolocation(GeolocationParams geolocationParams)
        {
            Dictionary <string, Object> json = new Dictionary <string, Object>();

            json.Add("ips", geolocationParams.GetIPAddresses());
            string jsonStr = JsonConvert.SerializeObject(json);

            String             urlParams    = BuildGeolocationUrlParams(geolocationParams);
            List <JObject>     apiResponse  = GetBulkApiResponse(jsonStr, urlParams);
            List <Geolocation> geolocations = new List <Geolocation>();

            foreach (JObject response in apiResponse)
            {
                geolocations.Add(new Geolocation(response));
            }
            return(geolocations);
        }