Skip to content

Instantly share code, notes, and snippets.

@schell
Created September 2, 2016 18:57
Show Gist options
  • Save schell/389e00f8e4dec4f1810ab0df021c5f31 to your computer and use it in GitHub Desktop.
Save schell/389e00f8e4dec4f1810ab0df021c5f31 to your computer and use it in GitHub Desktop.
Hashing API

GET /

Authentication

Clients must supply the following data

Response:

  • Status code 200

  • Headers: []

  • Supported content types are:

    • text/html;charset=utf-8
  • Response body as below.

<!DOCTYPE HTML><html><head><title>Example HTML</title></head><body><h1>Example HTML</h1><p>This is an example of html.</p></body></html>

GET /query/all

Authentication

Clients must supply the following data

Response:

  • Status code 200

  • Headers: []

  • Supported content types are:

    • text/html;charset=utf-8
    • application/json
<!DOCTYPE HTML><html><head><title>Query All</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script></head><body><div class=" container "><h1>All hashes and data</h1><table class="table-striped"><thead><tr><td>hash</td><td>data</td></tr></thead><tbody><tr><td><code>DHash {unDHash = 98738748392}</code></td><td><samp>Another image hash associated to arbitrary bytestring data</samp></td></tr><tr><td><code>DHash {unDHash = 12348738079817}</code></td><td><samp>Arbitrary bytestring data</samp></td></tr></tbody></table></div></body></html>
[{"98738748392":"Another image hash associated to arbitrary bytestring data"},{"12348738079817":"Arbitrary bytestring data"}]

GET /query/hash/:hash

Authentication

Clients must supply the following data

Captures:

  • hash: (string) the hash

GET Parameters:

  • limit
    • Values: 10, 20
    • Description: Limits the number of entries to this value.

Response:

  • Status code 200

  • Headers: []

  • Supported content types are:

    • text/html;charset=utf-8
    • application/json
<!DOCTYPE HTML><html><head><title>Query Hash</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script></head><body><div class=" container "><h1>Matching data</h1><table class="table-striped"><thead><tr><td>distance</td><td>data</td></tr></thead><tbody><tr><td>4</td><td><samp>Example arbitrary text data: a picture with a great match</samp></td></tr><tr><td>20</td><td><samp>Example arbitrary text data: a picture with a poor match</samp></td></tr><tr><td>64</td><td><samp>Example arbitrary text data: a picture with no match</samp></td></tr></tbody></table></div></body></html>
[[4,"Example arbitrary text data: a picture with a great match"],[20,"Example arbitrary text data: a picture with a poor match"],[64,"Example arbitrary text data: a picture with no match"]]

GET /query/image

Authentication

Clients must supply the following data

Response:

  • Status code 200

  • Headers: []

  • Supported content types are:

    • text/html;charset=utf-8
  • Response body as below.

<!DOCTYPE HTML><html><head><title>Example HTML</title></head><body><h1>Example HTML</h1><p>This is an example of html.</p></body></html>

POST /query/image

Authentication

Clients must supply the following data

Request:

  • Example: multipart/form-data
:file:

Response:

  • Status code 200

  • Headers: []

  • Supported content types are:

    • text/html;charset=utf-8
  • Response body as below.

<!DOCTYPE HTML><html><head><title>Example HTML</title></head><body><h1>Example HTML</h1><p>This is an example of html.</p></body></html>

GET /upload

Authentication

Clients must supply the following data

Response:

  • Status code 200

  • Headers: []

  • Supported content types are:

    • text/html;charset=utf-8
  • Response body as below.

<!DOCTYPE HTML><html><head><title>Example HTML</title></head><body><h1>Example HTML</h1><p>This is an example of html.</p></body></html>

POST /upload

Authentication

Clients must supply the following data

Request:

  • Example: multipart/form-data
:file:

Response:

  • Status code 200

  • Headers: []

  • Supported content types are:

    • text/html;charset=utf-8
  • Response body as below.

<!DOCTYPE HTML><html><head><title>Example HTML</title></head><body><h1>Example HTML</h1><p>This is an example of html.</p></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment