google 联系人 api 出现 404 错误
404 error on google contacts api
我想使用 google contacts api v3 来获取帐户的所有联系人,但是当我使用 jquery ajax 请求时,每个请求都会发生此错误:
jQuery.ajax({
url: "https://www.google.com/m8/feeds/contacts/default/full",
headers: {
'Authorization': "Bearer dff55.Cj_CA27T4Fsdfsdfsdfsdfds",
'Content-Type': 'application/json'
},
method: 'GET',
dataType: 'jsonp',
jsonp: false,
success: function (data) {
console.log('succes: ' + data);
},
error: function (data) {
console.log('error');
console.log(data);
}
});
我使用这个文档:https://developers.google.com/google-apps/contacts/v3/
但我认为 https://www.google.com/m8/feeds/contacts/default/full
有问题,因为任何请求的结果都是一回事! readyState: 4, status: 404, statusText: "error"
!
在搜索更多并向其他人询问我的问题后,将 alt=json
和 accesstoken 添加到 url 并禁用 jsonp: false
和 cache: true
因为请求需要 jsonp .
工作代码是这样的:
jQuery.ajax({
url: "https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token=" + hashdic["access_token"] + "&max-results=10&v=3.0",
headers: {
'Authorization': "Bearer XXXXX",
'Content-Type': 'application/json'
},
method: 'GET',
dataType: 'jsonp',
//jsonp: false,
//cache: true,
success: function (data) {
console.log('succes');
console.log(data);
},
error: function (data) {
console.log('error');
console.log(data);
}
});
参考:https://labs.magnet.me/nerds/2015/05/11/importing-google-contacts-with-javascript.html
我想使用 google contacts api v3 来获取帐户的所有联系人,但是当我使用 jquery ajax 请求时,每个请求都会发生此错误:
jQuery.ajax({
url: "https://www.google.com/m8/feeds/contacts/default/full",
headers: {
'Authorization': "Bearer dff55.Cj_CA27T4Fsdfsdfsdfsdfds",
'Content-Type': 'application/json'
},
method: 'GET',
dataType: 'jsonp',
jsonp: false,
success: function (data) {
console.log('succes: ' + data);
},
error: function (data) {
console.log('error');
console.log(data);
}
});
我使用这个文档:https://developers.google.com/google-apps/contacts/v3/
但我认为 https://www.google.com/m8/feeds/contacts/default/full
有问题,因为任何请求的结果都是一回事! readyState: 4, status: 404, statusText: "error"
!
在搜索更多并向其他人询问我的问题后,将 alt=json
和 accesstoken 添加到 url 并禁用 jsonp: false
和 cache: true
因为请求需要 jsonp .
工作代码是这样的:
jQuery.ajax({
url: "https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token=" + hashdic["access_token"] + "&max-results=10&v=3.0",
headers: {
'Authorization': "Bearer XXXXX",
'Content-Type': 'application/json'
},
method: 'GET',
dataType: 'jsonp',
//jsonp: false,
//cache: true,
success: function (data) {
console.log('succes');
console.log(data);
},
error: function (data) {
console.log('error');
console.log(data);
}
});
参考:https://labs.magnet.me/nerds/2015/05/11/importing-google-contacts-with-javascript.html