Work.upload.lookup: Difference between revisions
Jump to navigation
Jump to search
w>Jguillo No edit summary |
m 11 revisions imported |
||
(6 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. | 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 = | ||
Line 8: | Line 8: | ||
* '''Timestamp:''' Requires [[ztime parameter]] | * '''Timestamp:''' Requires [[ztime parameter]] | ||
* '''Authorization level:''' ADD | * '''Authorization level:''' ADD | ||
* '''API trust level''': Standard | |||
= Parameters = | = Parameters = | ||
* '''authkey*:''' Authorization key | * '''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 | * '''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 | *** 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 | ||
= | = Example = | ||
REQUEST: | REQUEST: | ||
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
- authkey*: Authorization key
- ztime*: Z-Timestamp
- filename*: File name of the work to upload
- 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)
* 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
- uploadurl: Upload URL
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>