2017-09-06 39 views
0

私は残りのAPIを使用してファイルタイプでカスタムフィールドを更新しようとしています。適切に使用してファイルをアップロードした後 :redmineでRESTを使用してカスタムフィールドをファイルタイプで更新するにはどうすればよいですか?

curl --data-binary "@test.pdf" -H "Content-Type: application/octet-stream" -X POST -H "X-Redmine-API-Key: e1d815b8963e7b3950d4bea47959f874be755a2c" https://redmine-dev/uploads.xml 

私は私のトークンを取得:

<?xml version="1.0" encoding="UTF-8"?> 
<upload> 
    <id>15</id> 
    <token>15.cb4...</token> 
</upload> 

そして、私はカスタムを更新しようとしたが、これらを使用して提出し、どれも働いた:

<?xml version="1.0"?> 
<issue> 
    <custom_fields type="array"> 
    <custom_field id="4"> 
     <token>15.cb4...</token> 
     <filename>test.pdf</filename> 
    </custom_field> 
    </custom_fields> 
</issue> 

<?xml version="1.0"?> 
<issue> 
    <custom_fields type="array"> 
    <custom_field id="4"> 
     <value> 
     <token>15.cb4...</token> 
     <filename>test.pdf</filename> 
     </value> 
    </custom_field> 
    </custom_fields> 
</issue> 

<?xml version="1.0"?> 
<issue> 
    <custom_fields type="array"> 
    <custom_field id="4"> 
     <value>15</value> 
    </custom_field> 
    </custom_fields> 
</issue> 

後各フィールドはデータベース内でクリアされます。

それぞれのカスタムフィールド(テキストと番号ベース)を同時に更新しています。また、ドキュメントをチェックしましたが、RESTを使用してカスタム添付ファイルを更新する方法の詳細は何もありません。

答えて

0

コードを調べた後はとても簡単でしたが、トークンは以前は使用されていなかった添付ファイルに属していなければなりません。

<?xml version="1.0"?> 
<issue> 
    <custom_fields type="array"> 
    <custom_field id="4"> 
     <value> 
     <token>15.cb4...</token> 
     </value> 
    </custom_field> 
    </custom_fields> 
</issue> 
関連する問題