Redmine - upload file to project

168 Views Asked by At

I want to upload a file to the "Files" section of a project in Redmine.

I've read the API documentation and were able upload the file and obtain a token with

curl -ik -d "@dummy.txt" -H "Content-Type:application/octet-stream" -X POST https://myredmine.local/uploads.json?filename=dummy.txt&key=mysecretapikey

This request returned e.g.

{"upload":{"id":174152,"token":"177152.17ace63347256470b75443c5aed7607f21fe3b90cc269d642404edb55dd00732"}}

I cannot find out how to create the request that adds the uploaded file to the file section of my project. I know it need to be a POST request to https://myredmine.local/projects/myproj/files.json where myproj is the identifier/slug of my project, but I cannot make it work. I've tried various things, e.g.:

curl -ik -X POST --header "Content-Type: application/json" --data '{"file": {"filename":"dummy.txt", "description":"Test upload via API","content_type": "", "token":"177152.177152.17ace63347256470b75443c5aed7607f21fe3b90cc269d642404edb55dd00732"}}' https://myredmine.local/projects/myproj/files.json?key=mysecretapikey
0

There are 0 best solutions below