Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Uploading a file

The uploadFile operation allows users to add a new file.This multipart post method is used to upload the file.

Info
titleMultipart 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.

Code Block
languagexml
titleuploadFile
<?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.
  • apiKeyThe API key of Teamwork.

Code Block
languagexml
titleSample request for uploadFile
curl -X POST 'http://localhost:8280/services/tw_uploadFile?apiUrl=https://wso2test.teamwork.com&clientIdapiKey=clark42ceiling' \
-F file=@/path/to/a/file.txt

...