curl 将数据发布到谷歌电子表格

标签 curl google-docs-api

在尝试将数据发布到谷歌表格时,我得到了

Content-Type application/x-www-form-urlencoded is not a valid input type.

我正在终端上尝试此命令

curl -X POST -d '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"><gsx:First>first name</gsx:First><gsx:Last>last name</gsx:Last></entry>' https://spreadsheets.google.com/feeds/list/0ArtbScpxn-LHdFQxQzJ3dDN2bEx2REFhYmo3UUxWUWc/od6/public/basic

最佳答案

这是一个老问题,但我想我应该继续提交我的发现。以下curl命令发布到我的测试Google表单。

curl -S -v -X POST --location https://docs.google.com/forms/d/1kqn-xxJeVL4ftczABTIHjonhlf9YUOUlMpsxzFT8Fok/formResponse \
-d entry.1915510022=curl \
-d entry.1382424262=ChriChri \
-d entry.1376741077=chriRoro%40um.com \
-d entry.1604030572=UM 
-d entry.561632175=743-555%2B6321 \
-d entry.655897781=Yetassisi \ 
-d entry.227031813=coment+comanet \
-d entry.345486329=Yes

据我所知,您需要设置 --location、-X POST,并使用 -d 条目添加表单数据。我发现最简单的方法是打开 Chrome 开发工具的“网络”选项卡,然后使用普通表单进行测试提交。然后您可以看到 -d 条目和 URL --location。笔记。我添加了反斜杠和回车符,但在 OSX 上,需要删除这些反斜杠才能在终端中执行命令

关于 curl 将数据发布到谷歌电子表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8682572/

相关文章:

javascript - IE9的跨域谷歌文档请求

google-docs-api - 即使是从同一帐户上传的,也禁止访问所提供的图像

php - 使用 php 从 Google 文档中读取内容

php - 禁止获取 twitch channel 源

javascript - 使用nodejs服务器读取并打印文件内容?

linux - Elasticsearch 连接到一些随机 IP

android - 是否可以将 Google 云端硬盘用作我的应用程序数据的主机?那么app数据可以上线吗?

Excel 公式转 Google 文档格式

PHP Curl Posting @Sign 返回 False

ubuntu - GuzzleHttp\Exception\ConnectException : cURL error 6: Could not resolve host