如何使用redmine中的REST更新文件类型的自定义字段?
问题描述:
我试图用其他的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更新自定义附件。
答
这是寻找到的代码之后很容易,但令牌必须属于以前未使用的附件。
<?xml version="1.0"?>
<issue>
<custom_fields type="array">
<custom_field id="4">
<value>
<token>15.cb4...</token>
</value>
</custom_field>
</custom_fields>
</issue>