コード例 #1
0
        public string Post([FromBody] FacebookWebhook auth)
        {
            AuthenticationResponse response = new AuthenticationResponse();

            if (auth != null)
            {
                using (WebClient wc = new WebClient())
                {
                    string temp   = JsonConvert.SerializeObject(auth);
                    var    result = wc.DownloadString("http://fbleadads.urad.expert/api/values/1?test" + JsonConvert.SerializeObject(auth));
                }
            }
            return(JsonConvert.SerializeObject(response));
        }
コード例 #2
0
        public string Get(int id)
        {
            Authentication auth = new Authentication
            {
                @object      = "page",
                fields       = "leadgen",
                verify_token = "1982944731975237|zfy5fBST0kAm6A43F07IMCXCgwc",
                callback_url = "http://35.189.169.186/authenticate/gettoken"
            };

            ValueClass valueClass = new ValueClass
            {
                ad_id        = "111",
                adgroup_id   = "222",
                created_time = DateTime.Now.ToString(),
                leadgen_id   = "333",
                page_id      = "444",
                form_id      = "555",
            };

            Leadgen leadgen = new Leadgen();

            leadgen.field = "leadgen";
            leadgen.value = valueClass;

            List <Leadgen> leadgenList = new List <Leadgen>();

            leadgenList.Add(leadgen);

            Entry entry = new Entry
            {
                id      = "test",
                time    = DateTime.Now.ToString(),
                changes = leadgenList
            };
            List <Entry> entryList = new List <Entry>();

            entryList.Add(entry);

            FacebookWebhook fw = new FacebookWebhook
            {
                @object = "page",
                entry   = entryList
            };

            using (WebClient wc = new WebClient())
            {
                string temp = JsonConvert.SerializeObject(fw);
                //wc.Headers.Add("Content-Type", "application/json");
                //var temp2 = "http://localhost:5000/api/values/1?para=" + JsonConvert.SerializeObject(fw);
                var result = wc.DownloadString("http://fbleadads.urad.expert/api/values?para=" + JsonConvert.SerializeObject(fw));
            }

            //using (WebClient wc = new WebClient())
            //{
            //    string temp = JsonConvert.SerializeObject(auth);
            //    wc.Headers.Add("Content-Type", "application/json");
            //    var result = wc.UploadString("http://35.189.169.186/api/values", "POST",
            //                                 JsonConvert.SerializeObject(fw));
            //}

            return("value" + id);
        }
コード例 #3
0
 public void Post([FromBody] FacebookWebhook fw)
 {
     var test = fw;
 }