我正在尝试使用Gmail REST APIs将一条消息标记为已读。
$('#markGmailRead').click(function(){
var request = $.ajax({
type: 'POST',
dataType: 'json',
headers: { "Authorization": "Bearer <<ACCESS KEY>>",
"Content-Type": "application/json"},
url: 'https://www.googleapis.com/gmail/v1/users/me/messages/<<MESSAGEID>>/modify',
data: {"addLabelIds": ["UNREAD"]}
})
request.done(function(data){
// when the Deferred is resolved.
console.log(data);
})
request.fail(function(){
// when the Deferred is rejected.
console.log('fail');
})
})
这会导致返回以下JSON:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "parseError",
"message": "Parse Error"
}
],
"code": 400,
"message": "Parse Error"
}
}
有其他人也遇到过这个问题吗?我不知道是什么原因导致的。