2017-09-06 73 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> 
相關問題