问题描述
有关谷歌文档列表API 的称之为上传,一切都归结为发送格式正确 HTTP POST
的要求,所以的当然的它实际上是一个新的创造,而不是其它现有文件的实际上传。 (创建通过 POST
要求是类似什么的通常描述为 REST API
,但在真正的 REST
你通常使用 PUT
请求而不是课程)。
While the docs call it "uploading", everything boils down to sending an appropriately formatted HTTP POST
request, so of course it can actually be a new creation rather than an actual "upload" of an otherwise existing file. (Creation through POST
requests is similar to what's normally described as a REST API
, though in real REST
you'd typically use a PUT
request instead of course).
您只需要创建数据重新$ P $的一个blob中列出的任何格式psenting文档的 - 这取决于你的编程语言,最简单的可能是文本/ CSV
为为preadsheet和应用程序/ RTF
的文本文档 - 然后将在适当格式化的 POST
数据。例如,为了使在简单的方式A S preadsheet(没有元数据),你可以 POST
是这样的:
You just need to create a blob of data representing your document in any of the formats listed here -- depending on your programming language, simplest may be text/csv
for a spreadsheet and application/rtf
for a text-document -- then put in in an appropriately formatted POST
data. For example, to make a spreadsheet in the simplest way (no metadata), you could POST
something like:
POST /feeds/default/private/full HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization: <your authorization header here>
Content-Length: 81047
Content-Type: text/csv
Slug: Example Spreadsheet
ColumnA, ColumnB
23, 45
有关其专用的API提供可以提供与此不那么硬任务帮助每个特定的编程语言;例如,在Python中,每,该API建议使用的ETag
来避免覆盖变化当多个客户端同时为上传(即创建或更新文档)。但是,$ P $直接pparing的POST总是可能的,因为几乎REST API记录为在协议底层的所有特定语言的API。
Each specific programming language for which a dedicated API is supplied may offer help with this not-so-hard task; for example, in Python, per the docs, the API recommends using ETags
to avoid overwriting changes when multiple clients are simultaneously "uploading" (i.e., creating or updating docs). But preparing the POST directly is always possible, since the almost-REST API is documented as the protocol underlying all language-specific APIs.
这篇关于如何在谷歌文档创建文档编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!