Uploading a file
The uploadFile
operation allows users to add a new file.This multipart post method is used to upload the file.
Info |
---|
title | 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. |
Code Block |
---|
language | xml |
---|
title | 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
Code Block |
---|
language | xml |
---|
title | Sample 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 |
...