Reputation: 2111
I have the following CMDB class structure configured in OTRS via configitem module:
[
{
Key => 'Field1',
Name => 'Name1',
Searchable => 1,
Input => {
Type => 'Text',
Size => 50,
MaxLength => 50, Required => 1,
}, {
Key => 'Field2',
Name => 'Name2',
Searchable => 1,
Input => {
Type => 'Text',
Size => 50,
MaxLength => 50, Required => 1,
},
Sub=>[ {
Key => 'Field2-1',
Name => 'Name2-1',
Searchable => 1,
Input => {
Type => 'Text',
Size => 50,
MaxLength => 50,
},
}, {
Key => 'Field2-2',
Name => 'Name2-2',
Searchable => 1,
Input => {
Type => 'Text',
Size => 50,
MaxLength => 50,
},
}, {
Key => 'Field2-3',
Name => 'Name2-3',
Searchable => 1,
Input => {
Type => 'Text',
Size => 50,
MaxLength => 50,
},
},
];
I am trying to create a new Configuration Item via REST-API (properly configured) with the following curl:
curl "http://url/nph-genericinterface.pl/Webservice/ws/ConfigItem?UserLogin=username&Password=password" -H "Content-Type: application/json" -d "{\"ConfigItem\":{\"Class\":\"class_name\", \"Name\":\"ci_name\",\"CIXMLData\":{\"Field1\":\"text_value_for_field1\",\"Field2\":\"text_value_for_field2\"}}}" -X POST
But the server answers with 500 Internal Server Error:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
root@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body></html>
If "Field2" is not a required field and I execute the following curl:
curl "http://url/nph-genericinterface.pl/Webservice/ws/ConfigItem?UserLogin=username&Password=password" -H "Content-Type: application/json" -d "{\"ConfigItem\":{\"Class\":\"class_name\", \"Name\":\"ci_name\",\"CIXMLData\":{\"Field1\":\"text_value_for_field1\"}}}" -X POST
The item is properly created, however, if despite of not being required, I assign some value to Field2, then 500 error is given back.
As Field2 has some sub-fields (even when they are not required ones), I think that there is some syntax mistake in my curl.
NOTE: When I create the CI via GUI with the same data, it is properly created.
Upvotes: 0
Views: 539