Skip to content

APIItemDownloadAuth

Lodle edited this page May 13, 2014 · 4 revisions

Table of Contents

Download Auth

This api authenticates a user before they can download a file.

Input

URL

 * http://api.desura.com/1/itemdownloadauth/[MEMBER_ID]/[AUTH_HASH] (for GET requests - recommended)
 * http://api.desura.com/1/itemdownloadauth (for post + vars below)

Post

 * member: Required numeric, the users "id"
 * authhash: Required, 32 chars
 * outtype: Not Required, response type: [ JSON | XML ]

Process

 1. When wanting to initiate a download server connection for an item this api is called
   * Invalid data will result in a 107 (validation error) being thrown.
   * Any other errors will result in a 100 (generic error) message being thrown.
 1. If the user is authorized to download 0 (ok) will be returned.
 1. REMEMBER: the authhash is currently configured to expire after 5days though it can be renewed by calling the [wiki:APIItemDownloadURL] at any time.

Output XML

0: Ok

<?xml version="1.0" encoding="utf-8"?> 
<itemdownloadauth xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="1">
	<status code="0"/>
	<item sitearea="mods" siteareaid="3">
		<mcf>14</mcf>
		<path>/mods/1/1/3/14.mcf</path>
	</item>
</itemdownloadauth>

107: Validation Error

<?xml version="1.0" encoding="utf-8"?> 
<itemdownloadauth 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 username field is required. The sitearea field is required. The siteareaid field is required. The build field is required. The authhash field is required. The authkey field is required. The path field is required.
	</status>
	<validation>
		<fields>
			<member>The member id field is required.</member>
			<authhash>The authhash field is required.</authhash>
		</fields>
	</validation>
</itemdownloadauth>

100: Generic Error

<?xml version="1.0" encoding="utf-8"?> 
<itemdownloadauth  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="desura" version="1">
	<status code="100">An error has occured</status>
</itemdownloadauth>

Output JSON

0: Ok

{
	'code' : 0,
	'mod' : 
		{
			'mcf' : 14,
			'path' : '/mods/1/1/3/14.mcf',
			'sitearea' : 'mods',
			'siteareaid' : 3,
		},
}

107: Validation Error

{
	'code' : 107,
	'message' : 'The username field is required. The sitearea field is required. The siteareaid field is required. The build field is required. The authhash field is required. The authkey field is required. The path field is required.',
	'validation' : 
		{
			'fields' : 
				{
					'member' : 'The member id field is required.',
					'authhash' : 'The authhash field is required.',
					'sitearea' : 'mods',
					'siteareaid' : 3,	
				},
		},
}

100: Generic Error

{
	'code' : 100,
	'message' : 'An error has occured',
}