Work.upload.lookup: Difference between revisions

From Safe Creative API
Jump to navigation Jump to search
w>Jguillo
No edit summary
m 11 revisions imported
 
(9 intermediate revisions by one other user not shown)
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 through dedicated upload servers. Before calling any of these components, you must call '''work.upload.lookup''' to get an upload server and id.


= Info =
= Info =
* '''Component name:''' work.upload.private
* '''Component name:''' work.upload.lookup
* '''Signature:''' Requires signature using the authkey's private key
* '''Signature:''' Requires signature using the authkey's private key
* '''Timestamp:''' Requires [[ztime parameter]]
* '''Timestamp:''' Requires [[ztime parameter]]
* '''Authorization level:''' ADD
* '''Authorization level:''' ADD
* '''API trust level''': Standard


= Parameters =  
= Parameters =  
* '''authkey*:''' Authorization key of the work owner
* '''authkey*:''' Authorization key
* '''ztime*:''' Z-Timestamp
* '''ztime*:''' Z-Timestamp
* '''filename*:''' File name of the work to upload
* '''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)
* '''bypost:''' Work will be uploaded using an [[upload servlet]] (true) or using [[work.upload.begin]], [[work.upload.chunk]] and [[work.upload.commit]] (false, default value)


<nowiki>* Required parameter</nowiki>
<nowiki>* Required parameter</nowiki>
Line 20: Line 21:
* '''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


= Sample =
= Example =
REQUEST:
REQUEST:


Line 44: Line 45:
</pre>
</pre>


REQUEST (bypost)
REQUEST (bypost):


  <nowiki>https://api.safecreative.org/v2/</nowiki>
  <nowiki>https://api.safecreative.org/v2/</nowiki>
Line 54: Line 55:
  &'''signature'''=68b97266ea439203402ac496f27016a01878290a
  &'''signature'''=68b97266ea439203402ac496f27016a01878290a


 
RESPONSE (bypost):
RESPONSE:


<pre>
<pre>
<?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>

Latest revision as of 08:07, 7 May 2021

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 through 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
  • API trust level: Standard

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

Example

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>