redmineredmine-api

Redmine Rest API - file attachment, upload token is not complete


I'm trying to add an issue with a file attachment but the response token is not complete.

It is the same error as http://www.redmine.org/boards/2/topics/42425 (5 years old question) but there is no response there.

The redmine used is a 3.2.1.stable.

I'm using https://www.redmine.org/projects/redmine/wiki/Rest_api#Attaching-files to know how to upload files, but when I do a POST to /uploads.json?filename=myFileName, the response is something like {"upload":{"token":"6898."}} The response code is still a 201, so it doesn't seem like there is an error.

The response to the API call should be something like {"upload":{"token":"7167.ed1ccdb093229ca1bd0b043618d88743"}}.

I tried using the partial token returned, to no avail. Anyone have an idea as to why the token is not okay / how to correct the problem?


Solution

  • In fact, the problem was that the file sent was empty.

    This answer may well be of help to someone.