API upload servlet: Difference between revisions

From Safe Creative API
Jump to navigation Jump to search
w>Jguillo
No edit summary
m 22 revisions imported
 
(16 intermediate revisions by 6 users not shown)
Line 16: Line 16:
= Returns =
= Returns =


The servlet returns an upload ticket (see [[work.upload.commit]]) directly (with no XML enclosure)
The servlet returns an '''upload ticket''' (see [[work.upload.commit]]) directly (with no XML enclosure)


= Sample =
= Example =


REQUEST:
REQUEST:
Line 30: Line 30:
3c33a96c-7743-43d0-9614-db70fa46d3ad
3c33a96c-7743-43d0-9614-db70fa46d3ad
--AaB03x
--AaB03x
Content-Disposition: file; name="file"; filename="file1.txt"
Content-Disposition: form-data; name="file"; filename="file1.txt"
Content-Type: text/plain
Content-Type: text/plain


Line 42: Line 42:
HvWIbGj7anDefJK3tQHdPze8ekYaVUQJgKw_N6t0Wd_UblANNOjyVfkyK0fgPXRPgiR8SyVr7HmS4Uiiediu6MlFVYIcjUD0zc4Kc8m3e2Irr14iQi-A215pEaqlvOSZ6WUIbWvY-GD2e8akWxhESdnFG088_nUHEsAjkOvnF-ogK144M4vLuIj4Ylc6inW-80LNnqH10kh7zMJcxsv0lZzTMGrXa2pN
HvWIbGj7anDefJK3tQHdPze8ekYaVUQJgKw_N6t0Wd_UblANNOjyVfkyK0fgPXRPgiR8SyVr7HmS4Uiiediu6MlFVYIcjUD0zc4Kc8m3e2Irr14iQi-A215pEaqlvOSZ6WUIbWvY-GD2e8akWxhESdnFG088_nUHEsAjkOvnF-ogK144M4vLuIj4Ylc6inW-80LNnqH10kh7zMJcxsv0lZzTMGrXa2pN
</pre>
</pre>
[[Category:API component]]

Latest revision as of 08:07, 7 May 2021

You can upload works using standard HTTP upload via POST multipart request.

The upload URL must be retrieved using work.upload.lookup

Info

HTTP request must be configured with header:

Content-Type: multipart/form-data

Parameters

  • uploadid*: Upload ID returned by work.upload.lookup.
    • Can be included in the POST body or as a querystring argument in the URL
  • file*: File contents as a file parameter in the POST body

Returns

The servlet returns an upload ticket (see work.upload.commit) directly (with no XML enclosure)

Example

REQUEST:

http://upload01.safecreative.org/api-upload
Content-Type: multipart/form-data; boundary=AaB03x

--AaB03x
Content-Disposition: form-data; name="uploadid"

3c33a96c-7743-43d0-9614-db70fa46d3ad
--AaB03x
Content-Disposition: form-data; name="file"; filename="file1.txt"
Content-Type: text/plain

These are the file contents
--AaB03x--

RESPONSE

HvWIbGj7anDefJK3tQHdPze8ekYaVUQJgKw_N6t0Wd_UblANNOjyVfkyK0fgPXRPgiR8SyVr7HmS4Uiiediu6MlFVYIcjUD0zc4Kc8m3e2Irr14iQi-A215pEaqlvOSZ6WUIbWvY-GD2e8akWxhESdnFG088_nUHEsAjkOvnF-ogK144M4vLuIj4Ylc6inW-80LNnqH10kh7zMJcxsv0lZzTMGrXa2pN