Esempio n. 1
0
        public async Task alarm()
        {

            using (var client2 = new HttpClient())
            {
 
                string token=careDeviceId;
                client2.BaseAddress = new Uri("https://api.pushbots.com/push/one");
                client2.DefaultRequestHeaders.Accept.Clear();
                client2.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client2.DefaultRequestHeaders.Add("x-pushbots-appid", "55eb927f177959b3338b4567");
                client2.DefaultRequestHeaders.Add("x-pushbots-secret", "50dd3c9198d1766e74a5964db3613e10");
                PushbotsOne onePush = new PushbotsOne();
                onePush.platform = 1;
                // onePush.schedule = "2015-09-08T01:20:00";
                onePush.token = token;
                onePush.msg = patientName + "is now out of fence ";
                Console.WriteLine("before repsonse");
                HttpResponseMessage response = await client2.PostAsJsonAsync("", onePush);
                Console.WriteLine("after response");
                apiResult = "post response";
                if (response.IsSuccessStatusCode)
                {
                    apiResult = "in OK";
                    //Uri patientURL = response.Headers.Location;
                }
                else
                {
                    apiResult = "in ERROR " + await response.Content.ReadAsStringAsync();
                }
            }

        }
Esempio n. 2
0
        public async Task alarm()
        {
            using (var client2 = new HttpClient())
            {
                string token = careDeviceId;
                client2.BaseAddress = new Uri("https://api.pushbots.com/push/one");
                client2.DefaultRequestHeaders.Accept.Clear();
                client2.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client2.DefaultRequestHeaders.Add("x-pushbots-appid", "55eb927f177959b3338b4567");
                client2.DefaultRequestHeaders.Add("x-pushbots-secret", "50dd3c9198d1766e74a5964db3613e10");
                PushbotsOne onePush = new PushbotsOne();
                onePush.platform = 1;
                // onePush.schedule = "2015-09-08T01:20:00";
                onePush.token = token;
                onePush.msg   = patientName + "is now out of fence ";
                Console.WriteLine("before repsonse");
                HttpResponseMessage response = await client2.PostAsJsonAsync("", onePush);

                Console.WriteLine("after response");
                apiResult = "post response";
                if (response.IsSuccessStatusCode)
                {
                    apiResult = "in OK";
                    //Uri patientURL = response.Headers.Location;
                }
                else
                {
                    apiResult = "in ERROR " + await response.Content.ReadAsStringAsync();
                }
            }
        }