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 1: Line 1:
Returns an upload URL and upload ID.
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.
To upload a work you must use [[work.upload.begin]], [[work.upload.chunk]] and [[work.upload.commit]] or upload the file by POST to an [[API upload servlet]]. 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 =
= Info =
Line 20: Line 20:
* '''workuploadlookup'''
* '''workuploadlookup'''
** '''uploadurl''': Upload URL
** '''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 true, ''uploadurl'' is the direct URL to an [[API upload 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 <tt>/v2/</tt> to the URL when calling components)
*** If bypost is false, ''uploadurl'' is the base URL of the upload API server (you will need to add <tt>/v2/</tt> to the URL when calling components)
** '''uploadid''': Upload ID, must be used as a parameter in the rest of upload components
** '''uploadid''': Upload ID, must be used as a parameter in the rest of upload components

Revision as of 14:16, 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 to an API upload servlet. 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.lookup
  • Signature: Requires signature using the authkey's private key
  • Timestamp: Requires ztime parameter
  • Authorization level: ADD

Parameters

* Required parameter

Returns

  • workuploadlookup
    • uploadurl: Upload URL
      • If bypost is true, uploadurl is the direct URL to an API upload 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>