Safe Creative API Web Services Reference v2 - D R A F T

work.attachfile

Info

Parameters

* Required parameter

Description

To attach a file to a work you must first upload it using the functions work.upload.lookup, work.upload.begin, work.upload.chunk and work.upload.commit, the same way you would upload a work for registering, obtaining an upload ticket.
'File attachment' professional service must be active for the authorizing user.

For example, you can upload a file by post using work.upload.lookup to ask for an URL for a http multi-part POST:


REQUEST:

https://api.safecreative.org/v2/
?authkey=1i5g2aaf2bz09lyo867cuimqg
&bypost=true
&component=work.upload.lookup
&filename=my+file+name
&ztime=1271749849181
&signature=bd51c643923a23468d80cb8584f00a839a75ecfa


RESPONSE:

<?xml version="1.0" encoding="UTF-8"?>
<workuploadlookup>
  <uploadurl>http://arena.safecreative.org/api-upload</uploadurl>
  <uploadid>8eb05901-2fb5-4596-b47f-21130c06fddb</uploadid>
</workuploadlookup>

Now post the content to the url obtained above (http://arena.safecreative.org/api-upload) with the required parameter uploadid:

RESPONSE (upload ticket):
HvWIbGj7anDefJK3tQHdPxp1swnY9x54Mr1xXCq40dg7SmFtNlOA6931SkqRyTtSaI-pk7zPbNymk_FIfu7EeH13-jBJKxHkZGJCVUsXd7S8gBqH8j-m8h18abRL1HIGOW1TiInUVAvf9uQoVbgbS-sLKCDM3BvZDO0rVJtv4wak5drfsxULmR6bc51phHvcRWVHcof1Des4FMh9dZKXCwVg_AypY2zq

Now you can attach the file to the work with the upload ticket obtained above:


REQUEST:

https://api.safecreative.org/v2/
?authkey=1i5g2aaf2bz09lyo867cuimqg
&component=work.attachfile
&public=1
&title=A+simple+attachment
&uploadticket=HvWIbGj7anDefJK3tQHdPxp1swnY9x54Mr1xXCq40dg7SmFtNlOA6931SkqRyTtSaI-pk7zPbNymk_FIfu7EeH13-jBJKxHkZGJCVUsXd7S8gBqH8j-m8h18abRL1HIGOW1TiInUVAvf9uQoVbgbS-sLKCDM3BvZDO0rVJtv4wak5drfsxULmR6bc51phHvcRWVHcof1Des4FMh9dZKXCwVg_AypY2zq
&workcode=1004200146116
&ztime=1271749851064
&signature=26ecbbf2e886483516a42314979323db5cb69804


RESPONSE:

<?xml version="1.0" encoding="UTF-8"?>
<error>
  <errorId>RestException</errorId>
  <errorMessage>Work attachments service not active</errorMessage>
</error>

TOC