Re: Re: Must Blogger.com API be "ON" to work?

Andreas S <[email protected]>
Newsgroups gmane.comp.web.blogger.api
Message-ID <[email protected]>
Thanks Luke,

I did not attach the API key as a parameter to the request. I only used 
clientID, clientSecret and refreshToken in order to get a new access_token, 
so I never used the API key during any steps of the Oath Flow.

I am not sure how you mean by enable my endpoint/C# program for the API key?
I can find my API key in "*Key for server applications*" and here it says:
IPS
Any IP allowed
ACTIVATION DATE
Feb 6, 2015, 4:06:00 PM

It was a good idéa to try the API Explorer, so I did that. I clicked "ON" 
to "Authorize requests using OAuth 2.0" and filled in my "blogId" only. 
This worked, a blog post was posted on my blog so something should be 
activated and work here?

This is the response screenshot with all details (I have erased some info 
though)
http://www.bilddump.se/bilder/20150313133207-195.252.32.111.bmp

When looking at the response, I can see that the request is using the API 
key ONLY? Is that enough to use in order to add a post to the blog. If I 
understood from the documentation: 
(https://developers.google.com/blogger/docs/3.0/using#AddingAPost) the API 
key could not be used in order to Add a post but I would need the 
refresh_token in order and request a new temporary access_token?

But I have tried to put up this example using the information from the 
response. I have only put the API key as seen and added a header: 
"Content-Encoding", "gzip". It was also shown in the response that 
"Content-Length" could be needed, is this critical to use, if so how can I 
calculate the length?

Below code gives a new error message. (See screenshot)
http://www.bilddump.se/bilder/20150313133753-195.252.32.111.bmp

            String requestUrl = 
"https://www.googleapis.com/blogger/v3/blogs/123456789/posts?key=myAPIkeyGoesHere";

            RestSharp.RestClient rc = new RestSharp.RestClient();
            RestSharp.RestRequest request = new 
RestSharp.RestRequest(requestUrl, RestSharp.Method.POST);
            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Content-Encoding", "gzip");
            //request.AddHeader("Content-Length", "???");

            request.AddParameter("blogid", "123456789");
            request.AddParameter("title", "Hello world");
            request.AddParameter("content", "A message in the blog post");


            request.RequestFormat = RestSharp.DataFormat.Json;

            RestSharp.RestResponse restResponse = 
(RestSharp.RestResponse)rc.Execute(request);
            RestSharp.ResponseStatus responseStatus = 
restResponse.ResponseStatus;



            MessageBox.Show(restResponse.Content.ToString() + "," + 
restResponse.Content.ToString().Length.ToString() + "," + 
responseStatus.ToString());





Den fredag 13 mars 2015 kl. 02:50:22 UTC+1 skrev Luke:
>
> Are you attaching the API key, as a parameter to the request? Have you 
> enabled your endpoint (i.e. your C# program) for the API key?
>
> Note that you don't need to set the 'kind' field; that's just part of the 
> response.
>
> If you want to verify what a successful post to the Blogger API is like, 
> use the api explorer. 
> https://developers.google.com/apis-explorer/#p/blogger/v3/blogger.posts.insert. 
> You can see the headers attached and what-not if you use developer tools in 
> chrome, for example.
>

-- 
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.