Work.upload.lookup: Difference between revisions

From Safe Creative API
Jump to navigation Jump to search
w>Jguillo
No edit summary
w>Jguillo
No edit summary
Line 59: Line 59:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<workuploadlookup>
<workuploadlookup>
   <uploadurl>http://upload.safecreative.org/api-upload</uploadurl>
   <uploadurl>http://upload01.safecreative.org/api-upload</uploadurl>
   <uploadid>c5866e13-6d9a-41a5-9578-eacba8c80e02</uploadid>
   <uploadid>c5866e13-6d9a-41a5-9578-eacba8c80e02</uploadid>
</workuploadlookup>
</workuploadlookup>

Revision as of 12:39, 5 May 2010

Returns an upload URL and upload ID.

To upload a work you must use work.upload.begin, work.upload.chunk and work.upload.commit or upload the file by POST. All these components are not available through the standard API endpoint (http://api.safecreative.org) but thrugh dedicated upload servers. Before calling any of these components, you must call work.upload.lookup to get an upload server and id.

Info

  • Component name: work.upload.private
  • Signature: Requires signature using the authkey's private key
  • Timestamp: Requires ztime parameter
  • Authorization level: ADD

Parameters

  • authkey*: Authorization key of the work owner
  • ztime*: Z-Timestamp
  • filename*: File name of the work to upload
  • bypost: Work will be uploaded using a HTTP multipart POST request (true) or using work.upload.begin, work.upload.chunk and work.upload.commit (false, default value)

* Required parameter

Returns

  • workuploadlookup
    • uploadurl: Upload URL
      • If bypost is true, uploadurl is the direct URL of a servlet which will handle the HTTP POST upload
      • If bypost is false, uploadurl is the base URL of the upload API server (you will need to add /v2/ to the URL when calling components)
    • uploadid: Upload ID, must be used as a parameter in the rest of upload components

Sample

REQUEST:

https://api.safecreative.org/v2/
?component=work.upload.lookup
&authkey=1i5g2aaf2bz09lyo867cuimqg
&filename=long.txt
&ztime=1271749837035
&signature=668eea80a7f6654a7ec65a74583bbacbc2edc6b5

RESPONSE:

<?xml version="1.0" encoding="UTF-8"?>
<workuploadlookup>
  <uploadurl>http://upload01.safecreative.org</uploadurl>
  <uploadid>3c33a96c-7743-43d0-9614-db70fa46d3ad</uploadid>
</workuploadlookup>

REQUEST (bypost):

https://api.safecreative.org/v2/
?component=work.upload.lookup
&authkey=1i5g2aaf2bz09lyo867cuimqg
&bypost=true
&filename=my+file+name
&ztime=1271749837445
&signature=68b97266ea439203402ac496f27016a01878290a

RESPONSE (bypost):

<?xml version="1.0" encoding="UTF-8"?>
<workuploadlookup>
  <uploadurl>http://upload01.safecreative.org/api-upload</uploadurl>
  <uploadid>c5866e13-6d9a-41a5-9578-eacba8c80e02</uploadid>
</workuploadlookup>