$tmp["status"] = $call["status"]; $tmp["createdAt"] = $call["created_at"]; array_push($response["calls"], $tmp); } echoRespnse(200, $response); }); /** * Listing single call of particual user * method GET * url /calls/:id * Will return 404 if the call doesn't belongs to user */ $app->get('/calls/:id', 'authenticate', function ($call_id) { global $user_id; $response = array(); $db = new Calls(); // fetch call $result = $db->getCall($call_id, $user_id); if ($result != NULL) { $response["error"] = false; $response["id"] = $result["id"]; $response["call"] = $result["call"]; $response["status"] = $result["status"]; $response["createdAt"] = $result["created_at"]; echoRespnse(200, $response); } else { $response["error"] = true; $response["message"] = "The requested resource doesn't exists"; echoRespnse(404, $response); } });