Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Error renaming folder name via Update Folder using cURL

Answered
New post

Comments

3 comments

  • mwiller

     I tried running the cURL command exactly as you have it there, and it seems to work just fine for me.  The error you're seeing indicates that the JSON body of your request couldn't be parsed correctly (though the command you pasted looks fine to me, and works fine when I run it).  Is there any way you can think of that the JSON might be getting malformed?  Maybe something with the quotes, or missing characters (e.g. commas between properties, closing braces)?

    0
    Comment actions Permalink
  • ksendhil

    Thanks for your response, mwiller!

     

    I tried the same command in Git Shell, and it worked fine.  For some reason, it doesn't run in Windows Command Prompt.

    0
    Comment actions Permalink
  • MattEB

    double-quote is a special character in cURL, so if you want to pass a double-quote you must escape it with backslash.  The box api documentation is misleading on the syntax to use for cURL.  For example, here is how to rename a folder. 

     

    cURL https://api.box.com:443/2.0/folders/FOLDER_ID?fields=name -H "Authorization:Bearer ACCESS_TOKEN" -H "Content-Type: application/json" -d "{\"name\":\"NEW_FOLDER_NAME\"}" -X PUT

    0
    Comment actions Permalink

Please sign in to leave a comment.