Search.byhash

From Safe Creative API
Revision as of 09:01, 6 May 2010 by w>Jguillo
Jump to navigation Jump to search

Search for works by specifying the SHA-1 or MD5 hash of the work contents.

This component must be called on the main API server http://api.safecreative.org

Binary hashes must be encoded as a string of hexadecimal lowercase digits (0123456789abcdef), using two digits per byte.

Results are paginated

Info

  • Component name: search.byhash
  • Signature: No signature required
  • Timestamp: Ztime is not required
  • API trust level: Public
  • API server: http://api.safecreative.org

Parameters

  • md5: MD5 hash of the searched work contents
  • sha1: SHA-1 hash of the searched work contents
  • user: User code. If specified only works owned by this user will be searched
  • page: Page number
  • locale: Locale for work type, license names,...

* Required parameter

Returns

Paginated list of work elements

  • work
    • code: Safe Creative work code
    • title: Work title
    • authors: List of authors
      • author
        • code: Author's Safe Creative user code
        • name: Author's full name
        • human-url: URL to the author's Safe Creative public profile
    • rights-holders: List of rights holders
      • rights-holder
        • code: Rights holder's Safe Creative user code
        • name: Rights holder's full name
        • human-url: URL to the rights holder's Safe Creative public profile
    • thumbnail: URL to the work thumbnail (if any)
    • license: Work license
      • code: License code
      • name: License name
      • shortname: License short name
      • human-url: URL to license text
      • features: License features (see user.licenses
    • human-url: URL to this work web page in Safe Creative
    • machine-url: URL to this work API info response (see work.get)

Sample

REQUEST (searching for photographs under a Creative Common license which can be downladed):

https://api.safecreative.org/v2/
?component=search.byhash
&md5=a4bba01211c830db0e3ee6d95686848b

RESPONSE:

<?xml version="1.0" encoding="UTF-8"?>
<listpage>
  <recordtotal>1</recordtotal>
  <pagetotal>1</pagetotal>
  <list>
    <work>
      <code>1004296139061</code>
      <state>REGISTERED</state>
      <title>The ant bee and flower</title>
      <authors>
        <author>
          <code>0709270000528</code>
          <name>Mario Pena Zapatería</name>
          <human-url>http://www.safecreative.org/user/0709270000528</human-url>
        </author>
      </authors>
      <rights-holders>
        <rights-holder>
          <code>0709270000528</code>
          <name>Mario Pena Zapatería</name>
          <human-url>http://www.safecreative.org/user/0709270000528</human-url>
        </rights-holder>
      </rights-holders>
      <thumbnail>https://thumbnails-safecreative-org.s3.amazonaws.com/1/</thumbnail>
      <license>
        <code>http://creativecommons.org/licenses/by-sa/3.0/</code>
        <name>Creative Commons Attribution Share Alike 3.0</name>
        <shortname>CC by-sa</shortname>
        <human-url>http://www.safecreative.org/license/http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-sa%2F3.0%2F</human-url>
        <features>
          <timelimited>NOT_APPLICABLE</timelimited>
          <recognition>YES</recognition>
          <commercial>YES</commercial>
          <distribution>YES</distribution>
          <derivations>INHERITANCE</derivations>
        </features>
      </license>
      <human-url>http://www.safecreative.org/work/1004296139061</human-url>
      <machine-url>http://www.safecreative.org/v2/?component=work.get&code=1004296139061</machine-url>
    </work>
  </list>
</listpage>