Google Contact API v3 通过 JavaScript 不创建 Contact
Google Contact API v3 via JavaScript not creating Contact
我想知道你能不能帮忙,拜托。
我正在尝试通过JavaScript使用Google Contact API v3来创建联系人,使用以下默认的ATOM + XML字符串:
var resource = '<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005"> <atom:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/> <gd:name> <gd:givenName>Elizabeth</gd:givenName> <gd:familyName>Bennet</gd:familyName> <gd:fullName>Elizabeth Bennet</gd:fullName> </gd:name> <atom:content type="text">Notes</atom:content> <gd:email rel="http://schemas.google.com/g/2005#work" primary="true" address="liz@gmail.com" displayName="E. Bennet"/> <gd:email rel="http://schemas.google.com/g/2005#home" address="liz@example.org"/> <gd:phoneNumber rel="http://schemas.google.com/g/2005#work" primary="true"> (206)555-1212 </gd:phoneNumber> <gd:phoneNumber rel="http://schemas.google.com/g/2005#home"> (206)555-1213 </gd:phoneNumber> <gd:im address="liz@gmail.com" protocol="http://schemas.google.com/g/2005#GOOGLE_TALK" primary="true" rel="http://schemas.google.com/g/2005#home"/> <gd:structuredPostalAddress rel="http://schemas.google.com/g/2005#work" primary="true"> <gd:city>Mountain View</gd:city> <gd:street>1600 Amphitheatre Pkwy</gd:street> <gd:region>CA</gd:region> <gd:postcode>94043</gd:postcode> <gd:country>United States</gd:country> <gd:formattedAddress> 1600 Amphitheatre Pkwy Mountain View </gd:formattedAddress> </gd:structuredPostalAddress></atom:entry>';
以及以下请求:
gapi.client.request({
'path': '/m8/feeds/contacts/default/full',
'headers': { 'Content-Type': 'application/atom+xml', 'GData-Version': 3.0 },
'method': 'POST',
'body': resource,
'callback': writeResponse
});
我得到的原始回复似乎在最后说它创建正常:
{"gapiRequest":{"data":{"body":"'n'n http://www.google.com/m8/feeds/contacts/martinkeywood%40gmail.com/base/2c9884718f97c163'n 2016-03-22T10:23:42.228Z'n 2016-03-22T10:23:42.228Z'n 'n 'n Notes'n 'n 'n 'n 'n Elizabeth Bennet'n Elizabeth'n Bennet'n 'n 'n 'n 'n (206)555-1212 'n (206)555-1213 'n 'n 1600 Amphitheatre Pkwy Mountain View 'n 1600 Amphitheatre Pkwy'n Mountain View'n CA'n 94043'n United States'n 'n'n","headers":{"ETag":"'"Q3w5cDVSLit7I2A9XRNbFkkIRQY.'"","Vary":"X-Origin","Content-Type":"application/atom+xml; charset=UTF-8","Date":"Tue, 22 Mar 2016 10:23:42 GMT","Expires":"Tue, 22 Mar 2016 10:23:42 GMT","Cache-Control":"private, max-age=0","Server":"GSE","Transfer-Encoding":"chunked"},"status":201,"statusText":"Created"}}}
但该联系人根本没有出现在我的谷歌通讯录中。
请问有什么想法吗??
要将联系人创建到"所有联系人"组中,您需要在联系人XML数据中分配"组成员信息"。
"<gContact:groupMembershipInfo deleted='"false'" href='"http://www.google.com/m8/feeds/groups/{USER EMAIL}/base/6'"/>"
即使您也可以使用Google联系人API版本3.0获取所有组ID。请参阅"使用联系人组"部分。获得所有组成员信息的列表后,您可以通过在上面的代码行中提供组ID来代替"6"来创建您的愿望组的联系人。
相关文章:
- 创建一个类似链接的按钮,并通过Javascript函数打开一个新的弹出窗口
- 为effect Composer创建GodRays效果过程
- 从javascript创建一个列表
- onkeyup无法动态创建多个文本区域
- 如何使用javascript从主svg对象动态创建svg视图框
- 如何访问声音管理器2创建的声音对象
- 我已经创建了一个jquery转盘,并使用if条件来运行和停止转盘
- Kendo:我该如何在树视图中创建一个递归的hieiarchy
- 使用Facebook live API创建实时视频对象时的隐私设置
- 在动态创建的元素上获取对特定选择器的引用
- 如何创建带有插槽的vue js组件预加载程序
- 如何在创建键时引用来自同一对象的键
- 如何创建JSON数组
- 从html创建一个指令,该指令按类名应用函数
- 使用Javascript创建测验页面
- 更改使用Chart.js创建的图表中的轴线颜色
- JavaScript名称空间和对象创建
- JQuery对动态创建的对象进行选择
- Google Contact API v3 通过 JavaScript 不创建 Contact
- Visualforce链接创建新的Account/Contact/