PixelDrain API Documentation

Hello, and Welcome to the API documentation of the PixelDrain file sharing platform!

Warning: This is the first version of the API, and may be subject to changes in future versions of PixelDrain.

Functions:

getfile

http://pixeldra.in/api/getfile/{fileId}

Returns the raw file with normal HTTP inline display headers. Also supports byte range requests using Davin Kevin 's MultipartFileSender implementation class.

Sample response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Disposition: inline; filename="Screenshot.png"
Accept-Ranges: bytes
Content-Type: image/png;charset=UTF-8
Content-Length: 1104591
Date: Wed, 12 Aug 2015 10:50:12 GMT
			

download

http://pixeldra.in/api/download/{fileId}

Returns the requested file with file attachment HTTP headers, this will initiate a file transfer dialog in most web browsers.
Does not support byte range requests.

Sample response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Description: File Transfer
Content-Disposition: attachment; filename="Screenshot.png"
Content-Type: image/png;charset=UTF-8
Content-Length: 1104591
Date: Wed, 12 Aug 2015 10:56:27 GMT
			

upload

http://pixeldra.in/api/upload

To upload a file POST to that URL. Your request must have two variables: "file", "fileName" and optionally "fileDesc".
"file" must contain a multipart file, the file can be at most 5,000,000,000 Bytes long.
"fileName" contains the name of the file which will be saved in the database. This name can be at most 290 characters long.
"fileDesc" can have a small description of the file. If this parameter is not passed it will default to "PixelDrain File". The description can be at most 5000 characters long.

When all requirements are met the file will be stored on the server and the response will look something like this:

{
	"id": "Ij2eqr",
	"type": "success",
	"url": "http://pixeldra.in/u/Ij2eqr"
}
			

getfileinfo

http://pixeldra.in/api/getfileinfo/{fileId}

Returns JSON formatted information about the requested file.
The "image" tag contains a thumbnail that represents the requested file.

Sample response:
{
	"image": "http://pixeldra.in/api/getfile/f1LeId",
	"fileName": "Screenshot.png",
	"date_upload": "2015-08-02 17:56:32.0",
	"mime": "image/png",
	"id": "f1LeId",
	"date_lastview": "2015-08-12 00:06:46.0",
	"views": 134,
	"desc": "Description of this file"
}
			

getlistinfo

http://pixeldra.in/api/getlistinfo/{listId}

Returns JSON formatted information about the requested file list.
The "data" tag contains all information about the files that this list contains.

Sample response:
{
	"data": [
		{
			"image": "http://pixeldra.in/res/img/mime/audio.png",
			"listDesc": "",
			"fileName": "Playlist Song 1.ogg",
			"size": 64315,
			"date_upload": "2015-08-05 16:49:57.0",
			"mime": "audio/x-vorbis+ogg",
			"id": "RXtVrb",
			"date_lastview": "2015-08-11 13:56:19.0",
			"fileDesc": null,
			"views": 17
		},
		{
			"image": "http://pixeldra.in/res/img/mime/audio.png",
			"listDesc": "",
			"fileName": "Playlist Song 2.ogg",
			"size": 63267,
			"date_upload": "2015-08-05 16:49:57.0",
			"mime": "audio/x-vorbis+ogg",
			"id": "sF6B0G",
			"date_lastview": "2015-08-06 15:06:21.0",
			"fileDesc": null,
			"views": 7
		},
		{
			"image": "http://pixeldra.in/res/img/mime/audio.png",
			"listDesc": "",
			"fileName": "Playlist Song 3.ogg",
			"size": 78637,
			"date_upload": "2015-08-05 16:49:59.0",
			"mime": "audio/x-vorbis+ogg",
			"id": "CNoeli",
			"date_lastview": "2015-08-05 17:32:48.0",
			"fileDesc": null,
			"views": 2
		}
	],
	"date_created": "2015-08-05 16:51:56.0",
	"id": "YipvJO",
	"title": "PixelDrain File List",
	"date_lastview": "2015-08-11 13:56:18.0",
	"views": 20
}
			

createlist

http://pixeldra.in/api/createlist

Creates a file list containing all provided file IDs and descriptions. All information must be provided using POST variables. Every ID and description has to be followed with by a number which represents the position in the list, starting with 0.

Sample request:
POST "http://pixeldra.in/api/createlist"
?id0=1KzjSz
&desc0=Description of the first file
&id1=hgFt59
&desc1=Description of file 2
&id2=gnV4Rd
&desc2=Description of the third file
			

This request will create a file list containing three files: 1KzjSz, hgFt59 and gnV4Rd.
The response you get will look something like this:

{
	"id": "j6Ey0F",
	"url": "http://pixeldra.in/l/j6Ey0F",
	"status": "success"
}
			

The "id" flag contains the ID handle of the created list, the "url" flag points to the viewer page of this list.

When one of the files in your request does not exist you will get something like this:

{
	"type": "file_does_not_exist",
	"value": "cZl45X",
	"status": "error"
}
			

The "value" field contains the ID of the file that is not present on the server.