String config = ConfigObjectUtility::CreateObjectConfig(type, name, ignoreOnError, templates, attrs);
+ Array::Ptr results = new Array();
+ results->Add(result1);
+
+ Dictionary::Ptr result = new Dictionary();
+ result->Set("results", results);
+
if (!ConfigObjectUtility::CreateObject(type, name, config, errors)) {
result1->Set("errors", errors);
- HttpUtility::SendJsonError(response, 500, "Object could not be created.");
+ result1->Set("code", 500);
+ result1->Set("status", "Object could not be created.");
+
+ response.SetStatus(500, "Object could not be created");
+ HttpUtility::SendJsonBody(response, result);
+
return true;
}
else if (!obj && ignoreOnError)
result1->Set("status", "Object was not created but 'ignore_on_error' was set to true");
- Array::Ptr results = new Array();
- results->Add(result1);
-
- Dictionary::Ptr result = new Dictionary();
- result->Set("results", results);
-
response.SetStatus(200, "OK");
HttpUtility::SendJsonBody(response, result);