Editing Validate invite token API
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | If you're creating a system that invites players to | + | If you're creating a system that invites players to WarLight 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: | + | You can do this by calling the following API: http://warlight.net/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 WarLight player. |
− | * name: The player's | + | * name: The player's WarLight nickname. |
− | * isMember: True if the player has purchased a | + | * isMember: True if the player has purchased a WarLight membership. |
* level: Their current level. | * level: Their current level. | ||
− | * color: The player's preferred | + | * color: The player's preferred WarLight 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. | ||
− | |||
== Template IDs == | == 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 | + | 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. | 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. | ||
Line 30: | Line 29: | ||
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 | + | An example request would look like http://warlight.net/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. |