require_once "class/ServiceRequest.class.php"; //Options for service request $options = array("authorization_prefix" => "Authorization", "host" => "http://*****:*****@email.com", "password" => "123456"], null, false); Utility::debug($auth); //Set the token for authenticated methods $userToken = $auth->payload->data->token; //Example of get request to an unauthenticated route to list user echo "<h2 style='color:green;'>[GET] Service route: /user/list_user [TOKEN: {$userToken}]</h2>"; $listUser = $serviceRequest->get("/user/list_user", null, null, false); Utility::debug($listUser); //Example of get request to an unauthenticated route to read single user echo "<h2 style='color:green;'>[GET] Service route: /user/read_user [TOKEN: {$userToken}]</h2>"; $readUser = $serviceRequest->get("/user/read_user", ["id" => 1], null, false); Utility::debug($readUser); //Example of post request to an authenticated route to create an user echo "<h2 style='color:green;'>[POST] Service: /user/create [TOKEN: {$userToken}]</h2>"; $create = $serviceRequest->post("/user/create", ["name" => "Darth Vader", "email" => "*****@*****.**", "password" => "123456"], $userToken, false); Utility::debug($create); //Example of put request to an authenticated route to update an user echo "<h2 style='color:green;'>[PUT] Service route: /user/update [TOKEN: {$userToken}]</h2>"; $update = $serviceRequest->put("/user/update", ["id" => 1, "name" => "Luke Skywalker"], $userToken, false); Utility::debug($update); //Example of delete request to an authenticated route to delete an user echo "<h2 style='color:green;'>[DELETE] Service route: /user/delete [TOKEN: {$userToken}]</h2>";