Overview
The following operations allow you to work with files. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with attachments, see Sample configuration.
Operation | Description |
---|---|
deleteFileFromProject | Delete a file from a project. |
getFile | Returns a file. |
getFilesOnAProject | Returns the files on a project. |
Operation details
This section provides further details on the operations related to discussions.
Deleting a file from project
The deleteFileFromProject
operation deletes a file from project.
<teamwork.deleteFileFromProject> <fileId>{$ctx:fileId}</fileId> </teamwork.deleteFileFromProject>
Properties
fileId
: The id of the file.
Sample Request
Following is a sample REST/JSON request that can be handled by the deleteFileFromProject
operation.
{ "apiUrl":"https://wso2test.teamwork.com/", "apiKey":"clark42ceiling", "fileId": "745098" }
Related Teamwork documentation
http://developer.teamwork.com/files#delete_a_file_fro
Retrieving a file
The getFile
operation retrieves the file of given id.
<teamwork.getFile> <fileId>{$ctx:fileId}</fileId> </teamwork.getFile>
Properties
fileId
: The id of the file.
Sample Request
Following is a sample REST/JSON request that can be handled by the getFile
operation.
{ "apiUrl":"https://wso2test.teamwork.com/", "apiKey":"clark42ceiling", "fileId": "745098" }
Related Teamwork documentation
http://developer.teamwork.com/files#get_a_single_file
Retrieving files on a project
The getFilesOnAProject
operation retrieves the files on a project.
<teamwork.getFilesOnAProject> <projectId>{$ctx:projectId}</projectId> </teamwork.getFilesOnAProject>
Properties
projectId
: The id of the project.
Sample Request
Following is a sample REST/JSON request that can be handled by the getFilesOnAProject
operation.
{ "apiUrl":"https://wso2test.teamwork.com/", "apiKey":"clark42ceiling", "projectId": "90538" }
Related Teamwork documentation
http://developer.teamwork.com/files#list_files_on_a_p
Sample configuration
Following is a sample proxy service that illustrates how to connect to Teamwork with the init
operation and use the getFile
operation. The sample request for this proxy can be found in getFile sample request. You can use this sample as a template for using other operations in this category.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="tw_getFile" transports="https http" startOnLoad="true" trace="disable"> <description/> <target> <inSequence> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="apiKey" expression="json-eval($.apiKey)"/> <property name="fileId" expression="json-eval($.fileId)"/> <teamwork.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiKey>{$ctx:apiKey}</apiKey> </teamwork.init> <teamwork.getFile> <fileId>{$ctx:fileId}</fileId> </teamwork.getFile> <respond/> </inSequence> <outSequence/> <faultSequence/> </target> </proxy>