diff --git a/application/controllers/Api.php b/application/controllers/Api.php index a94798177..8b7f22328 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -243,8 +243,15 @@ class API extends CI_Controller { $return_msg[]='Dryrun works'; } - http_response_code(201); - echo json_encode(['status' => 'created', 'type' => $obj['type'], 'string' => $obj['string'], 'adif_count' => $adif_count, 'adif_errors' => $adif_errors, 'messages' => $return_msg ]); + if ($adif_errors == 0) { + http_response_code(201); + echo json_encode(['status' => 'created', 'type' => $obj['type'], 'string' => $obj['string'], 'adif_count' => $adif_count, 'adif_errors' => $adif_errors, 'messages' => $return_msg ]); + } else { + $return_msg[]=$custom_errors; + http_response_code(400); + echo json_encode(['status' => 'abort', 'type' => $obj['type'], 'string' => $obj['string'], 'adif_count' => $adif_count, 'adif_errors' => $adif_errors, 'messages' => $return_msg ]); + } + }