Slim API, Problem with postman on PUT/DELETE/POST

Hi, I want to create an API and test it with Postman but I don’t know if this is a problem with Postman or with my code. But I have error only when I use Put / Post or Delete. Here my routes :

$app->post(‘/users’, function($request, $response, $args) use($app){
$request = $app->getInstance()->request();
$users = json_decode($request->getBody());
$sql = “INSERT INTO user (lastname, firstname, email, password, role) VALUES ({lastname}, {firstname}, {email}, {password}, {role})”;
try{
$stt = $bdd->query($sql);
$stt->bindParam(“lastname”, $user->lastname);
$stt->bindParam(“firstname”, $user->firstname);
$stt->bindParam(“email”, $user->email);
$stt->bindParam(“password”, $user->password);
$stt->bindParam(“role”, $user->role);
$stt->execute();
} catch(PDOException $e){
echo $e->getMessage();
}
});

$app->delete(‘/user/{uid}’, function($request, $response, $args) use($bdd){
$uid = $args[‘uid’];
$sql = “DELETE FROM user WHERE id='”.$uid.“'”;
foreach($bdd->query($sql) as $row){
$j = json_encode($row);
echo $j;
}
});

Put is not done, so I receive this error from Postman : Slim Application Error
A website error has occurred. Sorry for the temporary inconvenience.
And 500 internal server error.
I don’t get it, because when I use my Get routes I have no problem.
Thank you !

Does not exist anymore.

Ok, you know the new one ?

This is a good start :slight_smile: https://www.slimframework.com/docs/start/upgrade.html