API Documentation

Request Format

All request to the service are made in a REST-ful manner. To get going all you need is a simple HTTP GET action. The REST Endpoint URL is:

http://api.filemd5.net/v1/hash?url={URL to the file}

where the URL to the file is a url-encoded string.

Response Format

Various response formats are available, you can specify yours by setting the parameter "format" in the request with one of the following values:

JSON

http://api.filemd5.net/v1/hash?url={URL to the file}&format=json

As the default response format from this service is JSON, there is no need to specify this parameter unless you want to make the request explicit

XML

http://api.filemd5.net/v1/hash?url={URL to the file}&format=xml

JSONP

http://api.filemd5.net/v1/hash?url={URL to the file}&format=jsonp

The service will name the callback funtion "cbfunc" by default unless you specify otherwise using the "callback" parameter. To learn more about how to use this service with JSONP please read the Callback section.

Successful Responses

When a request is successful, the following JSON is returned:

{
	"status": "ok",
	"MD5":"ccd812bcc03fa19a32ef30eb74ff4799",
	"url":"http://www.google.co.uk/intl/en_uk/images/logo.gif",
	"size":"8706 bytes",
	"hashType":"complete"
}

Failure Responses

Failure responses:

{
	"status": "fail",
	"description": "unknown protocol: abc"
}

Callback Function

If you are using JSONP and you want to define your own callback method (function wrapper) add the parameter "callback" with your desired name as the value.

http://api.filemd5.net/v1/hash?url={URL to the file}&format=jsonp&callback={your defined callback}

You can find more information about this in the How To section.

Restrictions

If the file is bigger than 1MB (megabyte) only the first 1 048 576 bytes of the file will be used to calculate the MD5 hash. This will be noted in the response by setting "hashType" to "partial"

Examples

You can see a successful json request here.

Now that we got the high level stuff covered, you might like to have a look at a working Demo.