Skip to content

Instantly share code, notes, and snippets.

@michaelee
Created November 8, 2023 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelee/4e33bf12f5944151704342b148886926 to your computer and use it in GitHub Desktop.
Save michaelee/4e33bf12f5944151704342b148886926 to your computer and use it in GitHub Desktop.
Test HTTP calls for MP4 Battleship REST API
@hostname = 165.227.117.48
###
POST http://{{hostname}}/register
Content-type: application/json
{
"username": "michael",
"password": "aaa"
}
###
# @name login
POST http://{{hostname}}/login
Content-type: application/json
{
"username": "michael",
"password": "aaa"
}
###
@token = {{login.response.body.$.access_token}}
GET http://{{hostname}}/games
Authorization: Bearer {{token}}
###
# @name createGame
@token = {{login.response.body.$.access_token}}
POST http://{{hostname}}/games
Content-type: application/json
Authorization: Bearer {{token}}
{
"ships": ["A1", "B2", "C3", "D4", "E5"],
"ai": "oneship"
}
###
@token = {{login.response.body.$.access_token}}
GET http://{{hostname}}/games/1050
Authorization: Bearer {{token}}
###
@token = {{login.response.body.$.access_token}}
PUT http://{{hostname}}/games/1050
Content-type: application/json
Authorization: Bearer {{token}}
{
"shot": "C3"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment