Ejemplo n.º 1
0
        public void Post_Data()
        {
            var result = new APIRequest("https://www.googleapis.com/urlshortener/v1/url")
                .WithData(@"{ ""longUrl"":""http://www.google.com/"" }", "application/json")
                .Post()
                .Text;

            Console.WriteLine(result);
        }
Ejemplo n.º 2
0
        public void Post_JSON_Data()
        {
            var result = new APIRequest("https://www.googleapis.com/urlshortener/v1/url")
                .WithJSON(new { longUrl = "http://www.google.com/" })
                .Post()
                .Text;

            Console.WriteLine(result);
        }
Ejemplo n.º 3
0
        public void Working_With_JSON_Data()
        {
            var clicks = new APIRequest("https://www.googleapis.com/urlshortener/v1/url")
                .WithForm(new {	shortUrl = "http://goo.gl/fbsS", projection = "FULL" })
                .Get()
                .AsJSON().analytics.allTime.shortUrlClicks; // <-- dynamic!

            // note: WithFormData data are automatically issued as querystring variables for GET requests
            // You could also do:
            //   new APIRequest("https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl.fbsS&projection=FULL")

            Console.WriteLine(clicks);
        }
Ejemplo n.º 4
0
 public void Get_A_URL()
 {
     var text = new APIRequest("https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl/fbsS").Get().Text;
     Console.WriteLine(text);
 }