$response["message"] = "File is not an image"; echoResponse(400, $response); } } else { $response["error"] = true; $response["message"] = "Required file photo is missing or empty"; echoResponse(400, $response); } }); /** * Listing photos from a place * url /photos/:place_id * method GET * Will return 404 if the are any photo */ $app->get('/photos/:place_id', function ($place_id) { $response = array(); $db = new db_handler(); // fetch task $result = $db->getPhotosByPlaceId($place_id); if ($result != NULL) { $response["error"] = false; $response["photos"] = $result; echoResponse(200, $response); } else { $response["error"] = true; $response["message"] = "The requested place doesn't have any photo"; echoResponse(404, $response); } }); $app->run();