The issue wasn't in the API at all, but the requested method wasn't made properly, the method was being sent as ``DELETE`, so the DataSnap API wasn't recognizing it as a command. As the request as being made by Code Igniter 4.0.4 CURLRequest class as following:
$reqConfig = [
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json'
]
];
$verb = '`DELETE`'
$curl->request($verb, 'Listas/'.id_lista, $reqConfig);
It was solved changing the $verb
taking the "`" out.
The API DELETE function is now:
function TSM.CancelLista(const ID_LISTA: integer): TJSONObject;
const
_DELETE = 'DELETE FROM listas WHERE id = :id';
begin
Result := TJSONObject.Create;
with FormPrincipal do
begin
DB_Query.Active := false;
DB_Query.SQL.Text := _DELETE;
DB_Query.ParamByName('id').Value := ID_LISTA;
Try
DB_Query.ExecSQL;
Result.AddPair('Response', 'Lista deletada com sucesso');
Except on E : Exception do
Result.AddPair('Response', E.Message);
End;
end;
end;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…