プロジェクト

全般

プロフィール

Vote #72667

完了

Set filename used to store attachment updloaded via the REST API

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
56
issue_org_id:
12125
author_id:
46342
assigned_to_id:
1
comments:
5
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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)

journals

There's no option for now to set the actual file name of the attachment when uploading via the rest API.
--------------------------------------------------------------------------------
Implemented in r10678. You can now POST to @/uploads.xml?filename=image.jpeg@ to set the filename of your attachment on the file system.
--------------------------------------------------------------------------------
wow! that was fast!
thank you very much.
great help!
--------------------------------------------------------------------------------
It would be really great to update the documentation ;)
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,30428,API upload documentation is wrong

Admin Redmine さんが約4年前に更新

  • カテゴリREST API_32 にセット
  • 対象バージョン2.2.0_56 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0