} switch ($method) { case 'DELETE': if (strlen($id) > 1) { /* delete object from database $db->delete($endpoint,$id);*/ } else { /* return error */ } break; case 'POST': /* generate new ID and put object into database $db->put($endpoint,$id);*/ break; case 'GET': if (strlen($id) > 1) { /* fetch object from database $db->fetch($endpoint,$id);*/ echo $db->fetch($endpoint, $id); } else { /* return error */ } break; case 'PUT': if (strlen($id) > 1) { /*put object into database $db->put($endpoint,$id);*/ } else { /* generate new ID and put object into database $db->put($endpoint,$id);*/ } //$file = file_get_contents("php://input"); break; default: echo "fuckOff"; break;