How to add labels to posts from c#
Cristian Xty <[email protected]>
| Newsgroups | gmane.comp.web.blogger.api |
|---|---|
| Message-ID | <[email protected]> |
Hi ! I found a C# code that posts to blogger and i've been trying to my it
add label too but i can't figure it out... here's a portion of the code:
private void JSONPublish(string sid, string stitle, string scontent, string
token)
{
var http = (HttpWebRequest)WebRequest.Create(new
Uri("https://www.googleapis.com/blogger/v3/blogs/" + sid + "/posts/"));
http.Accept = "application/json";
http.ContentType = "application/json";
http.Method = "POST";
http.Headers.Add("Authorization", "Bearer " + token);
http.UseDefaultCredentials = true;
var vm = new { kind = "blogger#post", blog = new { id = sid },
title = stitle, content = scontent };
var dataString = JsonConvert.SerializeObject(vm);
string parsedContent = dataString;
Byte[] bytes = Encoding.UTF8.GetBytes(parsedContent);
Stream newStream = http.GetRequestStream();
newStream.Write(bytes, 0, bytes.Length);
newStream.Close();
var response = http.GetResponse();
var stream = response.GetResponseStream();
var sr = new StreamReader(stream);
var content = sr.ReadToEnd(); }
i tried adding labels = "label" in it but it doesn't work... if you need
the full code you can find it here:
http://csharp-tricks-en.blogspot.ro/2015/08/publish-posts-on-bloggercom-api-v30.html
Thank you for your help, have a good day!!!
--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/bloggerdev.
For more options, visit https://groups.google.com/d/optout.