Uploading a file
The uploadFile
operation allows users to add a new file.This multipart post method is used to upload the file.
Multipart processing
Multipart/form-data cannot be processed inside the ESB. Therefore, the ESB should be in a content-unaware status. To achieve this, configure a pass-through proxy, and then build the message from the client end and send it to the proxy.
uploadFile
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="tw_uploadFile" transports="https http" startOnLoad="true" trace="disable"> <description/> <target> <inSequence> <teamwork.init> <apiUrl>{$url:apiUrl}</apiUrl> <apiKey>{$url:apiKey}</apiKey> </teamwork.init> <teamwork.uploadFile/> <respond/> </inSequence> <outSequence/> <faultSequence/> </target> </proxy>
Properties
apiUrl:
The application URL of Teamwork.apiKey
: The API key of Teamwork.
Sample request for uploadFile
curl -X POST 'http://localhost:8280/services/tw_uploadFile?apiUrl=https://wso2test.teamwork.com&clientId=clark42ceiling' \ -F file=@/path/to/a/file.txt
Related Teamwork documentation
http://developer.teamwork.com/uploadingfiles