Difference between revisions of "Work.upload.chunk"

From Safe Creative API
Jump to navigation Jump to search
w>Jguillo
(Created page with 'Upload a part of a work contents. Work contents are sent encoded in base64. You can send a chunk more than once, and chunk order is not relevant. This component must be called o…')
 
w>Jguillo
Line 16: Line 16:
 
* '''uploadid*:''' Upload ID obtained from [[work.upload.lookup]]
 
* '''uploadid*:''' Upload ID obtained from [[work.upload.lookup]]
 
* '''data*:''' Chunk contents, Base64-encoded
 
* '''data*:''' Chunk contents, Base64-encoded
* '''offset*:''' Chunk position in the file contents
+
* '''offset*:''' Position of the first byte of the chunk in respect to the full file (first byte is 0)
** First chunk has offset 0
+
** If all chunks have the same size (''<chunksize>'' bytes)
** Second chunk has offset <chunksize>
+
*** First chunk has offset 0
** Third chunk has offset 2*<chunksize>
+
*** Second chunk has offset ''<chunksize>''
** ...
+
*** Third chunk has offset 2*''<chunksize>''
 +
*** ...
  
 
<nowiki>* Required parameter</nowiki>
 
<nowiki>* Required parameter</nowiki>

Revision as of 12:55, 5 May 2010

Upload a part of a work contents. Work contents are sent encoded in base64. You can send a chunk more than once, and chunk order is not relevant.

This component must be called on an upload API server returned by work.upload.lookup and after having called work.upload.begin with the same server and uploadid.

When you have sent all work content chunks, you must call work.upload.commit to finish the upload process.

Info

  • Component name: work.upload.chunk
  • 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
  • uploadid*: Upload ID obtained from work.upload.lookup
  • data*: Chunk contents, Base64-encoded
  • offset*: Position of the first byte of the chunk in respect to the full file (first byte is 0)
    • If all chunks have the same size (<chunksize> bytes)
      • First chunk has offset 0
      • Second chunk has offset <chunksize>
      • Third chunk has offset 2*<chunksize>
      • ...

* Required parameter

Returns

  • workuploadchunk
    • state: continue

Sample

REQUEST:

https://upload01.safecreative.org/v2/
?component=work.upload.chunk
&authkey=1i5g2aaf2bz09lyo867cuimqg
&data=VmVyeSBsb25nIGZpbGU%3D
&offset=0
&uploadid=3c33a96c-7743-43d0-9614-db70fa46d3ad
&ztime=1271749837035
&signature=f53cf9e21778719e599f6ad39bd85924ecb0bc23

RESPONSE:

<?xml version="1.0" encoding="UTF-8"?>
<workuploadchunk>
  <state>continue</state>
</workuploadchunk>