Re: [bloggerDev] Сan't transfer the data to the pos t (javascript)
Brett Morgan <[email protected]>
| Newsgroups | gmane.comp.web.blogger.api |
|---|---|
| Message-ID | <CAAFdGSerufOisOTFxg8+Pfyy+iF6UWxmzfwUboOjmeqthGfbgw@mail.gmail.com> |
I just created a post:
http://brettmorgan-big-blog-test.blogspot.com.au/2013/09/a-title.html
Request
POST https://www.googleapis.com/blogger/v3/blogs/3578945116330914181/posts?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer yaddayadda
X-JavaScript-User-Agent: Google APIs Explorer
{
"content": "Some random data",
"title": "A title"
}
Response
200 OK
- Show headers -
{
"kind": "blogger#post",
"id": "2242578073824460099",
"blog": {
"id": "3578945116330914181"
},
"published": "2013-09-09T18:19:00-07:00",
"updated": "2013-09-09T18:19:16-07:00",
"url": "http://brettmorgan-big-blog-test.blogspot.com/2013/09/a-title.html",
"selfLink": "https://content.googleapis.com/blogger/v3/blogs/3578945116330914181/posts/2242578073824460099",
"title": "A title",
"content": "Some random data",
"author": {
"id": "16258312240222542576",
"displayName": "Brett Morgan",
"url": "http://www.blogger.com/profile/16258312240222542576",
"image": {
"url": "http://img2.blogblog.com/img/b16-rounded.gif"
}
},
"replies": {
"totalItems": "0",
"selfLink": "https://content.googleapis.com/blogger/v3/blogs/3578945116330914181/posts/2242578073824460099/comments"
}
}
On Tue, Sep 10, 2013 at 1:50 AM, Volodymyr Yatsynych <[email protected]>wrote:
> New post created with out data - http://yatsynych.blogspot.com/. Problem
> on object *body_data*?
>
> My source:
> <!DOCTYPE html>
> <html>
> <head>
> <meta charset='utf-8' />
> </head>
> <body>
> <button id="authorize-button" style="visibility:
> hidden">Authorize</button>
> <script type="text/javascript">
> var clientId = '********';
> var apiKey = '********';
> var scopes = 'http://www.blogger.com/feeds';
>
> function handleClientLoad() {
> gapi.client.setApiKey(apiKey);
> window.setTimeout(checkAuth,1);
> }
>
> function checkAuth() {
> gapi.auth.authorize({client_id: clientId, scope: scopes,
> immediate: true}, handleAuthResult);
> }
>
>
> function handleAuthResult(authResult) {
> var authorizeButton =
> document.getElementById('authorize-button');
> if (authResult && !authResult.error) {
> authorizeButton.style.visibility = 'hidden';
> makeApiCallBlogger();
> } else {
> authorizeButton.style.visibility = '';
> authorizeButton.onclick = handleAuthClick;
> }
> }
>
> function handleAuthClick(event) {
> gapi.auth.authorize({client_id: clientId, scope: scopes,
> immediate: false}, handleAuthResult);
> return false;
> }
>
> function makeApiCallBlogger() {
>
> gapi.client.setApiKey('AIzaSyDFnBwpKVqjMm9NJ4L0Up5Y_bYpsaJdC6I');
> gapi.client.load('blogger', 'v3', function() {
>
> var body_data = {
> "kind": "blogger#post",
> "blog": {
> "id": "********"
> },
> "title": "A new post",
> "content": "With <b>exciting</b> content..."
> }
>
> var request = gapi.client.blogger.posts.insert({
> "blogId": '********',
> "body": body_data});
>
> request.execute(function(response) {
> alert(response.toSource());
> });
>
> });
> }
>
> </script>
> <script src="
> https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
> </body>
> </html>
>
> --
> 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/groups/opt_out.
>
--
Brett Morgan | Developer Relations Engineer, Google Maps |
[email protected] | profiles.google.com/brettmorgan
--
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/groups/opt_out.