[bloggerDev] Сan't transfer the data to the post (j avascript)
Volodymyr Yatsynych <[email protected]>
| Newsgroups | gmane.comp.web.blogger.api |
|---|---|
| Message-ID | <[email protected]> |
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.