Здравствуйте, хочу использовать google calendar api, есть вот такой код:
<html>
<head>
<script type="text/javascript" src="chrome_ex_oauthsimple.js"></script>
<script type="text/javascript" src="chrome_ex_oauth.js"></script>
<script>
var oauth = ChromeExOAuth.initBackgroundPage({
'request_url': 'https://www.google.com/accounts/OAuthGetRequestToken',
'authorize_url': 'https://www.google.com/accounts/OAuthAuthorizeToken',
'access_url': 'https://www.google.com/accounts/OAuthGetAccessToken',
'consumer_key': 'anonymous',
'consumer_secret': 'anonymous',
'scope': 'https://www.google.com/calendar/feeds/default/private/full',
'app_name': 'My Google Docs Extension'
});
function callback(resp, xhr) {
console.log(resp);
// ... Process text response ...
};
function onAuthorized() {
var url = 'https://www.google.com/calendar/feeds/default/owncalendars/full';
var request = {
'method': 'POST',
'headers' : {
'GData-Version': '2',
'Content-Type': 'application/json'
},
"parameters" : {
"alt" : "jsonc"
},
"body" : {
"data": {
"title": "Little League Schedule",
"details": "This calendar contains the practice schedule and game times.",
"timeZone": "Europe/Moscow",
"hidden": false,
"color": "#2952A3",
"location": "Oakland"
}
}
};
// Send: GET https://docs.google.com/feeds/default/private/full?alt=json
oauth.sendSignedRequest(url, callback, request);
};
oauth.authorize(onAuthorized);
</script>
</head>
</html>
На любой POST запрос я получаю вот такой ответ:
{«apiVersion»:«2.6»,«error»:{«code»:400,«message»:«Invalid JSON»,«errors»:[{«domain»:«GData»,«code»:«invalidJson»,«internalReason»:«Invalid JSON»}]}}
вроде все токены получаются, и json шлется правильный (http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html) Может быть кто сталкивался с такой проблемой, Спасибо.