Defect #6345
closedxml used by rest API is invalid
0%
Description
The xml format used by REST API to insert a bug seem to be invalid. In forum page : http://www.redmine.org/boards/2/topics/17070 an example show the following :
<issue> <project_id>1</project_id> <tracker_id>1</tracker_id> <subject>test2</subject> <description>desc1gsdfgsdg</description> <custom_field_values> <1>test</1> </custom_field_values> </issue>
Except that this XML code is invalid. Indeed:
http://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameStartChar
specify that every node should start by a char within :
NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
The result is that you cannot generate xml with DOM API. Currently, I use DOM but with a very bad workaround :
$aElem = $aXmlDoc->createElement("_TOREMOVE_1"); (...) $aXmlOut = str_replace("_TOREMOVE_","",$aXmlDoc->saveXML($aRoot));
Can you try to fix it ?
Updated by Jean-Philippe Lang about 13 years ago
- Status changed from New to Resolved
- Target version set to 1.0.5
- Affected version (unused) set to 1.0.4
- Resolution set to Fixed
- Affected version set to 1.0.4
Fixed in r4481. You can now use the piece of xml that the API returns to update custom fields:
<custom_fields> <custom_field id="1"> <value>Foo</value> </custom_field> ... </custom_fields>
Updated by Bruno Medeiros almost 13 years ago
If #6403 needed to be scheduled for 1.1.0, Shouldn't this issue be to 1.1.0 too?
Updated by Jean-Philippe Lang almost 13 years ago
- Status changed from Resolved to Closed
- Target version changed from 1.0.5 to 1.1.0
You're right. No feedback, I think it can wait 1.1.
Updated by Florent Fievez almost 13 years ago
The Example is bad, good one :
<custom_fields type="array"> <custom_field id="1"> <value>Foo</value> </custom_field> ... </custom_fields>
Updated by Marco Descher over 9 years ago
I just tried the following input
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <issue> <id>3273</id> <subject>ch.elexis.base.ch.legacy.feature.feature.group</subject> <description/> <start_date>2014-08-20T00:00:00+02:00</start_date> <project_id>0</project_id> <tracker_id>0</tracker_id> <custom_fields type="array"> <custom_field id="2" name="Abostatus"> <value>EXPIRED</value> </custom_field> </custom_fields> <project id="3" name="Praxis Dr. Mustermann"/> <tracker id="4" name="Service"/> </issue>
where the custom field is an enumeration, the value however is not updated to the provided EXPIRED.
This is Redmine 2.4.3.stable
Updated by Toshi MARUYAMA about 9 years ago
Marco Descher wrote:
I just tried the following input
[...]
where the custom field is an enumeration, the value however is not updated to the provided EXPIRED.
This is Redmine 2.4.3.stable
FTR:
#17760