如何在Box API 2.0中以程序化文件上传形式发送表单数据 [英] how to send form data in a programmatic file upload in box api 2.0
问题描述
以下是api 2.0框内文件上传中POST数据形式的正确示例吗?该文档说,文件名表单字段是一个字符串,但是当使用python发送帖子数据时,您实际上需要发送帖子中的文件内容。那么,content-disposition:form-data行是否位于正确的命名 filename字段并包含文件内容的方式下面?
Is the following a correct example of the form POST data in a file upload in the box api 2.0? The documentation says that the 'filename' form field is a string but when sending the post data in, say, python, you need to actually send the file contents in the post. So, is the content-disposition: form-data line below the correct way to name the 'filename' field and include the file contents?
Content-type: multipart/form-data, boundary=AaB03x
Content-length: 142
Authorization: BoxAuth api_key=MY_API_KEY&auth_token=MY_AUTH_TOKEN
--AaB03x
content-disposition: form-data; name="filename"; filename="test.txt"
Content-type: text/plain
testing box api 2.0
--AaB03x--
推荐答案
您提到了Python,尽管没有提到这是必需条件。
如果可以使用Ruby(另一种脚本语言),那么您将拥有一个非常不错的库来处理2.0版的Box API。
You mention Python, although you don't mention as being a requirement. If you can use Ruby (another scripting language) you have a very nice lib to deal with Box API at the 2.0 version.
该库名为< a href = https://github.com/attachmentsme/ruby-box rel = nofollow> ruby-box ,在自述文件中,您可以找到如何使用它。
The lib is named ruby-box and in the readme you can find how to use it.
这篇关于如何在Box API 2.0中以程序化文件上传形式发送表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!