Project

General

Profile

Actions

Feature #12125

closed

Set filename used to store attachment updloaded via the REST API

Added by Hannes Meier over 11 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

i upload a lot of jpegs for every project via rest-api.
When a project it finished it would be great if i could zip the projectattachements.

Therefore it would be great if my uploadfilenames would be adoptet for the files.

At the moment my api-uploaded files have a timestamp (and the token?) as filename. Even no fileextension.

121009092213_4665b2f7563a436f5f33df856cd9fe8d

Manually uploaded files have the timestamp and their uploadedname, like:
121015105646_X01_010_010.jpg

Am i using the rest-api wrong or is this feature not included yet?

my reduced python example:

url = self.__url("uploads.json")
headers = {'content-type': 'application/octet-stream'}
data = open(attachment).read()
r = requests.post(url, data = data, headers = headers)
token = json.loads(r.text)
token = token['upload']['token']

and

payload = dict(
    issue = dict (
        uploads = dict (
            upload = dict (
                token = token,
                filename = filename,
                ),
            ),
    )
)
r = requests.put(self.__url("issues/"+str(ticketid)+".json"), data = json.dumps(payload), headers = self.header)

Related issues

Related to Redmine - Defect #30428: API upload documentation is wrongClosed

Actions
Actions

Also available in: Atom PDF