我正在尝试将upload a file用于 box.com 我的帐户。
当我使用下面的命令时,它会抛出以下错误。
我无法弄清楚这里的语法问题是什么。
任何人都可以帮助我。 ?
curl -g https://upload.box.com/api/2.0/files/content -H "Authorization: Bearer Fn3A7dadfxSscUrfQbY7aSrj7ihR899TBgZ" -X POST -F attributes='{"name":"pappi.jpg", "parent":{"id":"0"}}' -F file=@pappi.jpg
{ “类型”: “错误”, “状态”:400, “代码”: “BAD_REQUEST”, “CONTEXT_INFO”:{ “错误”:[{ “原因”: “INVALID_PARAMETER”, “名称”:”实体主体“‘消息’:”无效 value''{name:pappi.jpg,'。实体主体应该是正确嵌套的 资源属性名称/值 一对 “}]},” HELP_URL “:” http://developers.box.com/docs/#errors “ ”消息“:” 坏 请求“,”request_id“:”93232892358c3571c303f0“}卷曲:(6)无法 解析主机:parent:{id
答案 0 :(得分:0)
我只是尝试使用dev令牌,它似乎有效。
curl https://upload.box.com/api/2.0/files/content
-H "Authorization: Bearer <devtoken>" -X POST
-F attributes='{"name":"ken.jpg", "parent":{"id":"0"}}'
-F file=@ken.jpg
{"total_count":1,"entries":[{"type":"file","id":"149964282905","file_version": {"type":"file_version","id":"159621506329","sha1":"078 8d369db76258c45b08be771ff4a55a43d9661"},"sequence_id":"0","etag":"0","sha1":"0788d369db76258c45b08be771ff4a55a43d9661","name":"ken.jpg","description":"","size":5079,"path_collection":{"total_count":1,"entries":[{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"All Files"}]},"created_at":"2017-03-21T14:48:46-07:00","modified_at":"2017-03-21T14:48:46-07:00","trashed_at":null,"purged_at":null,"content_created_at":"2017-03-21T14:48:46-07:00","content_modified_at":"2017-03-21T14:48:46-07:00","created_by":{"type":"user","id":"270956269","name":"Ken.Domen.Test","login":"ken.domen.test@nike.com"},"modified_by":{"type":"user","id":"270956269","name":"Ken.Domen.Test","login":"ken.domen.test@nike.com"},"owned_by":{"type":"user","id":"270956269","name":"Ken.Domen.Test","login":"ken.domen.test@nike.com"},"shared_link":null,"parent":{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"All Files"},"item_status":"active"}]}APYRDV30BA5D24:curl kdomen$