Project

General

Profile

API issue when attempting to POST custom field

Added by Chris Venne almost 11 years ago

Hi there,

Attempting to add an issue containing a CUSTOM field:

curl --insecure -X POST -H "Content-Type: text/xml" -d "<issue><subject>MyTest</subject><project_id>1</project_id><description>desc1</description><custom_fields type="array"><custom_field id="2"><value>Sev2</value></custom_field></custom_fields></issue>" http://4216cd0mykeyhere571938e60:X@my.ip.address.here:8888/redmine/issues.xml

I get this as an error:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>Redmine 500 error</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
margin:10px;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
</style>
<body>
<h1>Internal error</h1>
<p>An error occurred on the page you were trying to access.<br />
If you continue to experience problems please contact your Redmine administrator for assistance.</p>
<p>If you are the Redmine administrator, check your log files for details about the error.</p>
<p><a href="javascript:history.back()">Back</a></p>
</body>
</html>

The issue posts successfully WITHOUT the custom field... what on god's green earth am I doing wrong???

Thanks...

ps) I'd love the syntax for being able to 'UPDATE' (PUT?) issues as well


Replies (1)

RE: API issue when attempting to POST custom field - Added by Christopher Wong almost 11 years ago

You may want to use single quotes instead of double quotes for your data. This may work:

curl -k -X POST -H "Content-Type: application/xml" -X POST -d "<?xml version='1.0' encoding='ISO-8859-1'?><issue><subject>MyTest</subject><project_id>1</project_id><description>desc1</description><custom_fields type='array'><custom_field id='2'><value>Sev2</value></custom_field></custom_fields></issue>" http://4216cd0mykeyhere571938e60:X@my.ip.address.here:8888/redmine/issues.xml

    (1-1/1)