Difference between revisions of "Generate New Token"

From King Arthur's Gold Wiki
Jump to: navigation, search
(added "see also")
Line 8: Line 8:
  
 
== Successful Response ==
 
== Successful Response ==
With a proper request (authentication, etc), a response will look like:
+
'''Request:''' GET /player/FliesLikeABrick/token/new
 +
'''Other:''' Authentication header provided
 
  {"playerToken": "89653198-5d06-4a74-a8b1-2c41fa234df8FliesLikeABrick7a6b066760c6bff022e409ee014443745fb5b70cbad06ebe27070f8d909895d1636d7b6822b4757291416f68cbc1f5a385fed0b8e07b38b530ce437cd24fc91c"}
 
  {"playerToken": "89653198-5d06-4a74-a8b1-2c41fa234df8FliesLikeABrick7a6b066760c6bff022e409ee014443745fb5b70cbad06ebe27070f8d909895d1636d7b6822b4757291416f68cbc1f5a385fed0b8e07b38b530ce437cd24fc91c"}
  

Revision as of 19:30, 10 March 2012


Implementation Status: Implemented
URI: https://api.kag2d.com/player/$PLAYER/token/new
HTTP Verbs Supported: GET
Response Type: JSON dictionary
HTTP Auth Required: Yes

Successful Response

Request: GET /player/FliesLikeABrick/token/new Other: Authentication header provided

{"playerToken": "89653198-5d06-4a74-a8b1-2c41fa234df8FliesLikeABrick7a6b066760c6bff022e409ee014443745fb5b70cbad06ebe27070f8d909895d1636d7b6822b4757291416f68cbc1f5a385fed0b8e07b38b530ce437cd24fc91c"}

where playerToken is the token. There may be additional keys sent in the future, so plan accordingly in consumer code.

Error Conditions

These are examples of how errors are fed back to the HTTP client. This is not an exhaustive list, new error conditions/validation may be added at any point. If you need to hardcode against a certain indicator of an error condition, use the HTTP response code (e.g. 403)


Account not active

{"message": "Access Denied: Account is not active"}

Requesting a token for another user

{"message": "Access Denied: You are not authorized to request a token for this user"}

Account has a global ban issued

{"message": "Access Denied: Account suspended with global ban"}

See Also