Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string query = "delete from myfusiontable where ROWID = 1"
- string sdata = "sql=" + HttpUtility.UrlEncode(query);
- ASCIIEncoding encoding = new ASCIIEncoding();
- byte[] data = encoding.GetBytes(sdata);
- // Create the request, encode the query in the body of the post
- HttpWebRequest req = (HttpWebRequest)
- WebRequest.Create("https://www.googleapis.com/fusiontables/v2/query");
- req.Method = "POST";
- req.ContentType = "application/x-www-form-urlencoded";
- req.ContentLength = data.Length;
- // Add the authentication header
- req.Headers.Add("Authorization: " + access_token);
- var t = req.Headers.AllKeys;
- Stream sout = req.GetRequestStream();
- sout.Write(data, 0, data.Length);
- sout.Close();
- try
- {
- HttpWebResponse res = (HttpWebResponse)req.GetResponse();
- StreamReader stIn = new StreamReader(res.GetResponseStream());
- return stIn.ReadToEnd();
- }
- catch (WebException e)
- {
- StreamReader stIn = new StreamReader(e.Response.GetResponseStream());
- return stIn.ReadToEnd();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement