mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #1407 from int2001/api_error
If there was an error at inserting QSO via API, return 400
This commit is contained in:
@@ -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 ]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user