Skip to content
Lodle edited this page May 13, 2014 · 4 revisions

Table of Contents

CD Key Request

This is used to get a cd key for a game/mod.

Input

URL

 * http://api.desura.com/1/cdkey

Post

 * sitearea: String Required, Site area (mod, game)
 * siteareaid: Integer Required, Id of the mod/game
 * branch: Integer Required, Branch of item to request a key for
 * token: String Required, Hardware id, not used but good for future
 * validation: Not Required, String. Validation key if requested

Process

 1. When wanting to get a cd key for a mod or game this API is called
 2. A validation code should always be provided, however it is only required if the cd key has not already been successfully requested
   * If the branch does not require a CD key, a 117 (not required error) will be thrown. This error message should be ignored and the game should be launched.
   * Only logged in users can access this api, otherwise a 108 (permission error) being thrown.
   * Invalid data will result in a 107 (validation error) being thrown. 
   * If a validation request is needed and the validation input is incorrect or missing a 115 (validation required) will be thrown;
   * If the user is attempting to request the cd key for an item they have not begun downloading, a 116 (not ready error) will be thrown. 
   * If the user is attempting to request the cd key for a branch they do not own, a 110 (not found error) will be thrown.
   * Any other errors (i.e. no cd keys available) will result in a 100 (generic error) message being thrown.
 3. If no errors occur getting the data, 0 (ok) will be returned

Validation

Validation code is generated by:

Output

0: Ok

<?xml version="1.0" encoding="utf-8"?> 
<cdkey xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="1">
 	<status code="0"/>
	<key>ABCDE-12345-FGHIJ-67890-KLMNO</key>
</cdkey>

107: Validation Error

<?xml version="1.0" encoding="utf-8"?> 
<cdkey xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="1">
	<status code="107">
	The sitearea field is required.
	</status>
	<validation>
		<fields>
			<sitearea>The appidfield is required.</sitearea>
		</fields>
	</validation>
</cdkey>

115: Validation Required

<?xml version="1.0" encoding="utf-8"?> 
<cdkey xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="1">
	<status code="115">Please submit a validation code</status>
</cdkey>

108: Permission Error

<?xml version="1.0" encoding="utf-8"?> 
<cdkey xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="1">
	<status code="108">We&#39;re sorry but you do not have a valid cd key associated with the game/mod.</status>
</cdkey>

117: Not Required Error

116: Not Ready Error

110: Not Found Error

100: Generic Error

As above, only with different status code and text.
Clone this wiki locally