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 Brett, I have successfully installed the Google API library for C#. But when looking at the documentation for in this case: "Add a Post" https://developers.google.com/blogger/docs/3.0/using#AddingAPost There is no C# example of how to code this? Do you know any documentation for C# on how to implement the procedure or if the procedure can be posted here? Thank you! Den fredag 13 mars 2015 kl. 01:29:45 UTC+1 skrev Brett Morgan: > > Hi Andreas, > > It looks to me like you are rolling your own client library. OAuth isn't > fun to implement, so I'd suggest you use our pre-rolled client libraries - > https://developers.google.com/blogger/docs/3.0/libraries - we even have > one in C#. > > brett > > On Fri, Mar 13, 2015 at 11:24 AM Andreas S <[email protected] > <javascript:>> wrote: > >> Thank you Luke for answer, >> >> I got my API Enabled and can see that it is "ON" but still I get this >> error, see screenshot which shows exactly: >> Error:(authError,Invalid Credentials,header,Authorization) >> >> http://www.bilddump.se/bilder/20150313004049-195.252.32.111.bmp >> >> The thing is that it seems that I do everything exactly after the book, >> correctly! >> >> I have created a "refresh_token" successfully, which I use to create a >> temporary token which I will use. This is the URL I use to make a POST >> request: >> >> *"https://www.googleapis.com/oauth2/v3/token >> <https://www.googleapis.com/oauth2/v3/token>?" +* >> >> * >> "client_id=123456789-thisismyclientid.apps.googleusercontent.com >> <http://123456789-thisismyclientid.apps.googleusercontent.com>&" +* >> * "client_secret=thisismyclientsecret&" +* >> * "refresh_token=thisismyrefreshtoken&" +* >> * "grant_type=refresh_token";* >> >> I successfully create a token, see this screenshot of the message which I >> receive: >> Returns: (access_token: thetoken, token_type: bearer, expires_in: 3600) >> >> http://www.bilddump.se/bilder/20150313004608-195.252.32.111.bmp >> >> Now I use this "access_token" and create this POST like below. As seen I >> have put the access_token like below with bearer: >> "*bearer THISISTHERETURNEDacces_token*" >> >> String requestUrl = " >> https://www.googleapis.com/blogger/v3/blogs/123456789/posts/"; >> >> RestSharp.RestClient rc = new RestSharp.RestClient(); >> RestSharp.RestRequest request = new >> RestSharp.RestRequest(requestUrl, RestSharp.Method.POST); >> request.AddHeader("Content-Type", "application/json"); >> request.AddHeader("Authorization", "bearer >> THISISTHERETURNEDacces_token"); >> >> request.AddParameter("kind", "blogger#post"); >> request.AddParameter("blogid", "123456789"); //My blog ID >> request.AddParameter("title", "Hello world how are you"); >> request.AddParameter("content", "A posting message here. How >> are you"); >> >> >> request.RequestFormat = RestSharp.DataFormat.Json; >> >> RestSharp.RestResponse restResponse = >> (RestSharp.RestResponse)rc.Execute(request); >> RestSharp.ResponseStatus responseStatus = >> restResponse.ResponseStatus; >> >> //This gives the error message, shown in the first link in this post >> MessageBox.Show(restResponse.Content.ToString() + "," + >> responseStatus.ToString()); >> >> I really can't figure out what I am doing wrong. I am completely stuck. >> >> Thank you for your time in advance! >> >> >> >> >> >> >> >> Den onsdag 11 mars 2015 kl. 22:24:02 UTC+1 skrev Luke: >> >>> Hi Andreas, >>> >>> Yes, you need to have the API enabled. This requires your request for an >>> API key to be processed. Until it has been approved, you will get auth >>> errors. >>> >>> Luke >>> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/bloggerdev. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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.