Exemplo n.º 1
0
             $status = array('status' => 'OK');
             http_response_code(204);
             echo json_encode($status);
         } else {
             // error
             echo returnError(404, "Unknown request: [{$http_method} {$resource}]");
         }
     }
     break;
 case "cart":
     session_start();
     if ($http_method == "GET" && $param == null) {
         ApiUtils::getCartProducts();
     } else {
         if ($http_method == "POST" && $param != null) {
             ApiUtils::addInCart($param);
         } else {
             if ($http_method == "PUT" && $param != null) {
                 ApiUtils::editCart($param);
             } else {
                 if ($http_method == "DELETE" && $param != null) {
                     ApiUtils::removeFromCart($param);
                 } else {
                     // error
                     echo returnError(404, "Unknown request: [{$http_method} {$resource}]");
                 }
             }
         }
     }
     break;
 case "narocilo":