- hangman-client: https://github.com/octater/hangman-client
Verb | URI Pattern | Controller#Action |
---|---|---|
POST | /sign-up |
users#signup |
POST | /sign-in |
users#signin |
PATCH | /change-password/:id |
users#changepw |
DELETE | /sign-out/:id |
users#signout |
Request:
curl http://localhost:4741/sign-up \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "'"${EMAIL}"'",
"password": "'"${PASSWORD}"'",
"password_confirmation": "'"${PASSWORD}"'"
}
}'
[email protected] PASSWORD=hannah scripts/sign-up.sh
Response:
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 1,
"email": "[email protected]"
}
}
Request:
curl http://localhost:4741/sign-in \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "'"${EMAIL}"'",
"password": "'"${PASSWORD}"'"
}
}'
[email protected] PASSWORD=hannah scripts/sign-in.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 1,
"email": "[email protected]",
"token": "BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f"
}
}
Request:
curl --include --request PATCH "http://localhost:4741/change-password/$ID" \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"passwords": {
"old": "'"${OLDPW}"'",
"new": "'"${NEWPW}"'"
}
}'
ID=1 OLDPW=hannah NEWPW=elle TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/change-password.sh
Response:
HTTP/1.1 204 No Content
Request:
curl http://localhost:4741/sign-out/$ID \
--include \
--request DELETE \
--header "Authorization: Token token=$TOKEN"
ID=1 TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/sign-out.sh
Response:
HTTP/1.1 204 No Content
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /users |
users#index |
GET | /users/1 |
users#show |
Request:
curl http://localhost:4741/users \
--include \
--request GET \
--header "Authorization: Token token=$TOKEN"
TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/users.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"users": [
{
"id": 2,
"email": "[email protected]"
},
{
"id": 1,
"email": "[email protected]"
}
]
}
Request:
curl --include --request GET http://localhost:4741/users/$ID \
--header "Authorization: Token token=$TOKEN"
ID=2 TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/user.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 2,
"email": "[email protected]"
}
}
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /games |
games#index |
POST | /games |
games#create |
PATCH | /games/:id |
games#update |
DELETE | /games/:id |
games#destroy |
Request:
curl http://localhost:4741/games \
--include \
--request GET \
--header "Authorization: Token token=$TOKEN"
TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/games/show-games.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"games": [
{
"id": 117,
"user_id": 13,
"game_status": 2,
"letters_played": 7,
"phrase_id": 9
},
{
"id": 1222,
"user_id": 13,
"game_status": 0,
"letters_played": 0,
"phrase_id": 4
}
]
}
#### POST /games
Request:
```sh
curl --include --request POST http://localhost:4741/games \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"game": {
"phrase_id": '10',
"user_id": '12',
"letters_played": '0',
"game_status": '0'
}
}'
TOKEN="BAhJIiVlN2I2MmVjMDE5YjFiOWVlZjMyZmI4ODFhYmQ2Y2I3NgY6BkVG--7ef3a3dead45e71c9617279bf655891b73a5e728" sh scripts/games/create-game.sh
Request:
API="${API_ORIGIN:-http://localhost:4741}"
URL_PATH="/games/$ID"
curl "${API}${URL_PATH}" \
--include \
--request PATCH \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"game": {
"letters_played": "'"${LETTERS}"'",
"game_status": "'"${STATUS}"'"
}
}'
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /phrases |
phrases#index |
GET | /phrases/:id |
phrases#show |
GET | /phrase_picker |
phrases#picker |
Request:
curl --include --request GET http://localhost:4741/phrase_picker
scripts/phrases/random-phrase.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"phrase":
{
"id": 4,
"phrase_content": "ICEBOX",
"phrase_hint": "Baby its cold in here"
}
}
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].