Documents
Document Conversion
GET
http://www.mediafire.com/conversion_server.php
- Description:
- Allows a document, spreadsheet or presentation to be converted into an image or HTML file for viewing. This API does not modify the source file.
- Notes:
- none
- Required Parameters:
-
- The first 4 characters of the file hash (see example)
quickkey
: A document, spreadsheet or presentation file key.page
: The page number to convert.doc_type
: Specifies what type of conversion to perform.d
(document).output
: The type of file to convert to.img
orhtml
.
- Optional Parameters
-
size_id
: Whenoutput=img
the size of the returned image can be specified. If not passed the size defaults to the native resolution. Sizes are in terms of DPI, not pixel width and height.0
(224x224)1
(163x163)2
(102x102)metadata
: Specifies to start the conversion process but only return file data and conversion progress. Used to poll for when the file is ready for viewing.1
.request_conversion_only
: Specifies to start the conversion process but not to return file or conversion progress data. Used to preemptively convert a file for use in the near future.1
.timestamp
: The time this file was last modified. If the file content changes, this is one way to pull a fresh converted version and bypass the cached version.domain
: If the domain is passed andoutput=html
the converted HTML document's origin header will be set to this domain as a security measure to isolate potentially malicious documents.session_token
: A valid session or image action token. Used to determine permissions to the file when the share link is disabled.
Response Properties
Name | Description | Type | Value |
---|---|---|---|
HTTP Status Codes: | |||
HTTP 200 | Request received. Blocking requests will have the file in the response | integer | |
HTTP 202 | Request accepted and in progress | integer | |
HTTP 204 | Unable to fulfill request. The document will not be converted | integer | |
HTTP 304 | Content not changed. Browser will use cached version | integer | |
HTTP 400 | Bad request. Check your arguments | integer | |
HTTP 404 | Unable to find file from quickkey | integer | |
page_request | The page number of the page requested for conversion | integer | |
document_status | Indicates if a document conversion is complete | string | COMPLETE |
state | The status of the conversion request | string | IN_PROGRESS, ERROR, UNCONVERTED, COMPLETE |
page_status | The status of the page conversion request | string | IN_PROGRESS, ERROR, UNCONVERTED, COMPLETE |
filename | The name of the file | string | |
height | The height, in pixels, of the page returned | integer | |
width | The width, in pixels, of the page returned | integer | |
pages | The total number of pages in the file | integer | |
error_code | The error code if the conversion request failed to process | integer | 7001(bad request), 7002(missing file data), 7004(invalid hash), 7006(invalid quickkey), 7008(private file), 8004(missing page parameter), 8005(invalid output argument) |
Success with blocking request(synchronous) and
output=img
Request
http://www.mediafire.com/conversion_server.php?faa4&quickkey=s2aj2zfq93vbk9f&doc_type=d&output=img&page=1
Response
<image file>
Success with non-blocking request(asynchronous) using
metadata=1
Request
http://www.mediafire.com/conversion_server.php?faa4&quickkey=s2aj2zfq93vbk9f&doc_type=d&output=img&page=1&metadata=1
Response
{
height:792,
pages:11,
width:612,
page_request:1,
document_status:COMPLETE,
state:COMPLETE,
page_status:COMPLETE,
filename:Getting Started with MediaFire.pdf
}
Success with non-blocking request(asynchronous) using
request_conversion_only=1
Request
http://www.mediafire.com/conversion_server.php?faa4&quickkey=s2aj2zfq93vbk9f&doc_type=d&output=img&page=1&request_conversion_only=1
Response
<empty>