我正在尝试使用 rest API 更新具有文件类型的自定义字段。使用正确上传文件后:
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 更新自定义附件。