API Spec - WyreCoder/puz GitHub Wiki

This be the API spec page. These are all REST.

All requests should contain the token in the "Authorization" header (ie. Authorization: token MY_LOGIN_TOKEN)

## POST /api/v1/login Parameters:

  • username: User's name
  • password: User's password

Response:

{
	"username": "my username",
	"id": 123091309213902139201321,
	"token": "MY_LOGIN_TOKEN",
	"score": 30495,
	"health": [99, 100]
}

GET /api/v1/scores

This returns JSON object like:

{
	"username": "my username",
	"id": 123091309213902139201321,
	"score": 30495,
	"health": [99, 100]
}

GET /api/v1/search

Parameters:

  • latitude: Your latitude
  • longitude: Your longitude

This returns a JSON object like:

{
	"latitude": 50.xx,
	"longitude": 0.xx,
	"items": [
		{
			"challenge_id": 1903232432,
			"type": "quiz",
			"complete": false
		}
	]
}

GET /api/v1/challenge

Parameters:

  • challenge_id: 210319349

This returns a JSON object like:

{
	"challenge_id": 210319349,
	"complete": false,
	"type": "RIDDLE",
	"question": "What is the square root of the world?",
	"answers": ["answer1", "answer2"]
}

POST /api/v1/challenge/complete

Parameters:

  • challenge_id: 210319349

Returns

{
	"success": 1,
	"username": "my username",
	"id": 123091309213902139201321,
	"score": 30501,
	"health": [99, 100]
}

POST /api/v1/challenge/fail

Parameters:

  • challenge_id: 210319349

Returns

{
	"success": 1,
	"username": "my username",
	"id": 123091309213902139201321,
	"score": 30501,
	"health": [99, 100]
}