Token

POST - Create

Create a token through user authentication


URI:

/token

METHOD:

POST

PARAMETERS:

username
	structure:		(string)
	length:			(3 <-> 40)
	validate		required | type:username | user:exists | user:active

password
	structure:		(string)
	length:			(10 <-> 256)
	validate		required | type:password | user_password:match

RETURN:

{
	"success": true,
	"reasons": [
		{
			"code": "C-T-authenticate-00",
			"message": "success"
		}
	],
	"results": {
		"token": "b1cd0a8ca5c6ffdbc1857dac51106fb0b039450a9486093b1fe3e7ad5153276203b0a1e557a6108aab6543a29bdfdef279f42a5a6eb5f3cf68f6b3d7aa2bd4de",
		"username": "username",
		"expire_at": "2016-07-21 11:29:48"
	}
}

GET - Validate

Refresh / Validate a token


URI:

/token

METHOD:

GET

PARAMETERS:

token
	structure:		(string)
	length:			(128)
	validate		required | type:token | token:exists | token:active

RETURN:

{
	"success": true,
	"reasons": [
		{
			"code": "C-T-validate-00",
			"message": "success"
		}
	],
	"results": {
		"token": {
			"type": "1",
			"hash": "b1cd0a8ca5c6ffdbc1857dac51106fb0b039450a9486093b1fe3e7ad5153276203b0a1e557a6108aab6543a29bdfdef279f42a5a6eb5f3cf68f6b3d7aa2bd4de",
			"user_id": "1",
			"created_at": "2016-07-09 00:36:43",
			"updated_at": "2016-07-18 12:14:06",
			"expired_at": "2016-07-21 12:14:06"
		},
		"user": {
			"id": 1,
			"username": "username",
			"gps_key": null,
			"gps_lat": null,
			"gps_lon": null,
			"created_at": "2016-06-06 14:01:00",
			"updated_at": "2016-07-18 11:29:48",
			"deleted_at": null
		}
	}
}

DELETE - Invalidate

Delete / Remove a token


URI:

/token

METHOD:

DELETE

PARAMETERS:

token
	structure:		(string)
	length:			(128)
	validate		required | type:token | token:exists | token:active

RETURN:

{
	"success": true,
	"reasons": [
		{
			"code": "C-T-invalidate-00",
			"message": "success"
		}
	],
	"results": {
		"token": {
			"type": "1",
			"hash": "c1857da9486093b1fe3e4de1cd0a8ca57adc5110608aa03bdfdef279fa1e557a61f3cf68f42a5a6eb5fb0bb9450ab6543a2906b3d7aa2bdc6ffdb5153276203b",
			"user_id": "1",
			"created_at": "2016-07-09 00:36:43",
			"updated_at": "2016-07-18 12:18:08",
			"expired_at": "2016-07-21 12:18:08"
		}
	}
}