cURL with HubSpot API for moving files



I have been trying to use cURL (on windows) to move files from one area to another while renaming the file from the documentation here:

This is the command I am using and it is not working. Any help would be appreciated (i’ve removed the api key and ids for personal purposes and replace with nines for folder and eights for file id ):

curl -v -H "Accept: application/json" -X POST -d {"folder_id":"9999999","name":"file_new_name"}

This is the response I am getting:

Note: Unnecessary use of -X or --request, POST is already inferred.

  • Trying…
  • Connected to ( port 80 (#0)

POST /filemanager/api/v2/files/99999999?hapikey=jldasljkadsjlkadsjklasdjkl HTTP/1.1
User-Agent: curl/7.46.0
Accept: application/json
Content-Length: 59
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 59 out of 59 bytes
    < HTTP/1.1 415 Unsupported Media Type
    < Access-Control-Allow-Credentials: false
    < Content-Length: 0
    < Date: Tue, 30 Aug 2016 23:37:56 GMT
    < Connection: close
  • Closing connection 0


Hi @ajlaporte

The example linked on that page has the wrong URL, it needs to include /move-file at the end. Also, you’ll need to include the content-type: application/json header in your request (the -d option defaults to application/x-www-form-urlencoded), and you may need to escape the JSON data as well:

curl -v -H "Content-Type: application/json" -X POST -d "{\"folder_id\":\"9999999\",\"name\":\"file_new_name\"}"

I’ll get the documentation page updated with the correct example URL.


Thank You David. Makes sense why this wasn’t working even when trying the content type.