Commit 21f1f902 authored by Zohten's avatar Zohten

check

parent 56f97b7c
......@@ -52,6 +52,11 @@ class GameController extends Controller
*/
protected function getAllGames()
{
// Auth with token phase (id = 0 because not used when checking validtoken)
$authResponse = $this->authUser(-1, 'admin');
if($authResponse->getCode()!=200){
return $authResponse;
}
$games = Game::getList();
$response = Response::okResponse(json_encode($games, JSON_PRETTY_PRINT));
return $response;
......
### Récupérer un token admin
POST http://localhost/index.php/login
{
"login": "admin",
"pwd": "hashedadminpwd"
}
### Récupérer un token utilisateur
POST http://localhost/index.php/login
{
"login": "testtest",
"pwd": "$2a$10$4AAhcsd4FpiPvUS718BemuGivzgRcsgxWbaSNdD.dK4wNwJAn.lQO"
}
### Récupérer toutes les games
GET http://localhost/index.php/game
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDY5OTI4NzIsImV4cCI6MTYwNjk5NjQ3MiwiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjciLCJyb2xlIjoiMiIsImVtYWlsIjoiYmVsb3ZlZC5hZG1pbkBmcmVlLmZyIn19.pDqIGydCz5AtOInm8QDcpQ29GiQtN2Hq7LgyYWqUaa4
### Récupérer la game avec id 3
### TODO : check if user is in the game
GET http://localhost/index.php/game/3
### Récupérer toutes les games publiques
GET http://localhost/index.php/game/public
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDY5OTI5NDgsImV4cCI6MTYwNjk5NjU0OCwiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjgiLCJyb2xlIjoiMSIsImVtYWlsIjoidGVzdEBmcmVlLmZyIn19.f75qyLwTfjOB75vFgrwp5iZe1SgJnVULjC9jq642Vis
### Ouverture d'une game
POST http://localhost/index.php/game
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDY5OTI5NDgsImV4cCI6MTYwNjk5NjU0OCwiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjgiLCJyb2xlIjoiMSIsImVtYWlsIjoidGVzdEBmcmVlLmZyIn19.f75qyLwTfjOB75vFgrwp5iZe1SgJnVULjC9jq642Vis
{
"is_private": "0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment