xml – 通过cURL向Google电子表格添加一行 – 必填字段错误
所以文档
here非常清楚地表明,使用XML格式的字段名将POSTing XML添加到表单的列表feed url中将插入一个新行.
Auth是工作和授权的帐户可以访问表.所有这些错误都解决了. 所以当我发布到https://spreadsheets.google.com/feeds/list/key/mySheetIDHere/private/full没有我得到 “发布的条目缺少一个或多个必填字段:标题” 所以我添加了< title>< / title>除了以前存在的< gsx:Title>< / gsx:Title>而且已经消失了,而被替代 “发布的条目缺少一个或多个必填字段:rowCount” 所以我尝试添加一个int,即当前行计数,但该错误仍然存??在. 当前的XML在下面 <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"> <title>A Title</title> <rowCount>3</rowCount> <gsx:Title>A Title</gsx:Title> <gsx:Name>A Name</gsx:Name> <gsx:Email>An email</gsx:Email> <gsx:Phone>A phone</gsx:Phone> </entry> 文档对于所需的字段或行计数一无所知.任何人都知道我在做错什么?
这是工作,这里是
a Gist with all of my scripts.从您的URL,您可能会以
add a worksheet端点而不是
add a list row终结点开机.工作表端点期望像您所看到的标题和rowCount.你想要的是一个看起来像的URL
https://spreadsheets.google.com/feeds/list/$spreadsheet_id/$worksheet_id/private/full 我设置了a spreadsheet测试三列: >水果 我用苹果,红色,中等的方式播放它(hah!),因为我测试了auth和阅读,然后用这个cURL命令添加了Orange,Orange,Medium curl --header "Authorization: GoogleLogin auth=$auth" --header 'Content-Type: application/atom+xml' -d @data.xml -X POST "https://spreadsheets.google.com/feeds/list/$spreadsheet_id/$worksheet_id/private/full" 哪里: > $auth是从https://www.google.com/accounts/ClientLogin获取的我的Google身份验证令牌 而data.xml如下所示: <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"> <gsx:fruit>Orange</gsx:fruit> <gsx:color>Orange</gsx:color> <gsx:size>Medium</gsx:size> </entry> 我注意到这些列都已经被低估了 – 我不知道是否重要.我还注意到,除了结构化元素之外,当我获取行时,还有标题和内容标签,但是标题是您看到的标题错误的红色鲱鱼. <!-- GET https://spreadsheets.google.com/feeds/list/$spreadsheet_id/$worksheet_id/private/full --> <!-- snip --> <title type="text">Apple</title> <content type="text">color: Red,size: Medium</content> <gsx:fruit>Apple</gsx:fruit> <gsx:color>Red</gsx:color> <gsx:size>Medium</gsx:size> <!-- snip --> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |