Validate invite token API: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
If you're creating a system that invites players to | If you're creating a system that invites players to Warzone games via the [[Create game API]], you may wish to validate whether or not an invite token or e-mail address is valid before you attempt to invite them to a game. | ||
Of course, if you invite a player to a game with their token, the [[Create game API]] will inform you that it's invalid. But you may wish to determine whether or not it's valid before attempting to create a game, such as when a new player signs up on your site. | Of course, if you invite a player to a game with their token, the [[Create game API]] will inform you that it's invalid. But you may wish to determine whether or not it's valid before attempting to create a game, such as when a new player signs up on your site. | ||
You can do this by calling the following API: https://www. | You can do this by calling the following API: https://www.warzone.com/API/ValidateInviteToken?Token=12345678 | ||
To call this programmatically, you can POST your e-mail address and API token to this page in the format Email=your@email.com&APIToken=yourapitoken You can get your API token from the [[Get API Token API]]. | To call this programmatically, you can POST your e-mail address and API token to this page in the format Email=your@email.com&APIToken=yourapitoken You can get your API token from the [[Get API Token API]]. | ||
Line 9: | Line 9: | ||
This will return the following fields about the player whose token you provided: | This will return the following fields about the player whose token you provided: | ||
* tokenIsValid: This simply tells you that the token does belong to a | * tokenIsValid: This simply tells you that the token does belong to a Warzone player. | ||
* name: The player's | * name: The player's Warzone nickname. | ||
* isMember: True if the player has purchased a | * isMember: True if the player has purchased a Warzone membership. | ||
* level: Their current level. | * level: Their current level. | ||
* color: The player's preferred | * color: The player's preferred Warzone color. | ||
* tagLine: The tagline the player has set up to display on their profile page. | * tagLine: The tagline the player has set up to display on their profile page. | ||
* clotpass: See [[CLOT Authentication]] | * clotpass: See [[CLOT Authentication]] | ||
Line 20: | Line 20: | ||
* levelForMapUsage: The level the system considers them when determining what maps they can use. If their level is 5, but their levelForMapUsage is 10, they can use maps that unlock at 6-10, even though their level isn't techincally high enough. | * levelForMapUsage: The level the system considers them when determining what maps they can use. If their level is 5, but their levelForMapUsage is 10, they can use maps that unlock at 6-10, even though their level isn't techincally high enough. | ||
* featuresUnlocked: What features they've unlocked, either from leveling up or purchasing a membership. | * featuresUnlocked: What features they've unlocked, either from leveling up or purchasing a membership. | ||
* onVacationUntil: Expiration date of current vacation. | |||
== Template IDs == | == Template IDs == | ||
Line 29: | Line 30: | ||
To use this, provide a parameter named TemplateIDs (either via the query string or POST param) which contains a comma-delimited list of template IDs. You may pass up to 20 template IDs per call. | To use this, provide a parameter named TemplateIDs (either via the query string or POST param) which contains a comma-delimited list of template IDs. You may pass up to 20 template IDs per call. | ||
An example request would look like https://www. | An example request would look like https://www.warzone.com/API/ValidateInviteToken?Token=12345678&TemplateIDs=342040,342041,342042,342043 | ||
The API will return results for each template ID provided in the returned JSON. Each template will return a "result" node that contains the string "CanUseTemplate", "CannotUseTemplate", or another string if an error occurred. If "CannotUseTemplate" is returned, there will be an additional node named "reasonCode" that explains why the player was unable to use the template. | The API will return results for each template ID provided in the returned JSON. Each template will return a "result" node that contains the string "CanUseTemplate", "CannotUseTemplate", or another string if an error occurred. If "CannotUseTemplate" is returned, there will be an additional node named "reasonCode" that explains why the player was unable to use the template. |
Latest revision as of 03:39, 13 November 2017
If you're creating a system that invites players to Warzone games via the Create game API, you may wish to validate whether or not an invite token or e-mail address is valid before you attempt to invite them to a game.
Of course, if you invite a player to a game with their token, the Create game API will inform you that it's invalid. But you may wish to determine whether or not it's valid before attempting to create a game, such as when a new player signs up on your site.
You can do this by calling the following API: https://www.warzone.com/API/ValidateInviteToken?Token=12345678
To call this programmatically, you can POST your e-mail address and API token to this page in the format Email=your@email.com&APIToken=yourapitoken You can get your API token from the Get API Token API.
This will return the following fields about the player whose token you provided:
- tokenIsValid: This simply tells you that the token does belong to a Warzone player.
- name: The player's Warzone nickname.
- isMember: True if the player has purchased a Warzone membership.
- level: Their current level.
- color: The player's preferred Warzone color.
- tagLine: The tagline the player has set up to display on their profile page.
- clotpass: See CLOT Authentication
- createPlayerLimit: The maximum game size that they can create.
- lowestUsableLuckModifier: The lowest setting they can specify for the luck modifier when creating games.
- levelForMapUsage: The level the system considers them when determining what maps they can use. If their level is 5, but their levelForMapUsage is 10, they can use maps that unlock at 6-10, even though their level isn't techincally high enough.
- featuresUnlocked: What features they've unlocked, either from leveling up or purchasing a membership.
- onVacationUntil: Expiration date of current vacation.
Template IDs
Optionally, you can also provide a list of Template IDs to this API. The API will check if the player has access to be a part of games created by the Create game API using this template.
This is helpful if you plan to invite them to a game via the API and you don't want to manually check their featuresUnlocked parameter against the features you know that your template uses.
To use this, provide a parameter named TemplateIDs (either via the query string or POST param) which contains a comma-delimited list of template IDs. You may pass up to 20 template IDs per call.
An example request would look like https://www.warzone.com/API/ValidateInviteToken?Token=12345678&TemplateIDs=342040,342041,342042,342043
The API will return results for each template ID provided in the returned JSON. Each template will return a "result" node that contains the string "CanUseTemplate", "CannotUseTemplate", or another string if an error occurred. If "CannotUseTemplate" is returned, there will be an additional node named "reasonCode" that explains why the player was unable to use the template.
An example return looks like this:
"template342040": { "result": "CanUseTemplate" }, "template342041": { "result": "CannotUseTemplate", "reasonCode": "MapLocked" }, "template342042": { "result": "CannotUseTemplate", "reasonCode": "AttackOnlyTransferOnlyLocked" }, "template342043": { "result": "error: template not found" }