【问题标题】:CURL upload file box.com issueCURL 上传文件 box.com 问题
【发布时间】:2017-08-01 12:30:51
【问题描述】:

我正在尝试将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

{"type":"error","status":400,"code":"bad_request","context_info":{"errors":[{"reason":"invalid_parameter","name":"实体主体","消息":"无效 值''{名称:pappi.jpg,'。实体主体应该是正确嵌套的 资源属性名称/值 对"}]},"help_url":"http://developers.box.com/docs/#errors","message":"不好 请求","re​​quest_id":"93232892358c3571c303f0"}curl: (6) 不能 解析主机:父:{id

【问题讨论】:

    标签: curl box


    【解决方案1】:

    我刚刚用开发令牌试了一下,它似乎可以工作。

    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$ 
    

    【讨论】:

      猜你喜欢
      • 2015-06-10
      • 2016-05-31
      • 2012-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-17
      相关资源
      最近更新 更多