This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Files in Teamwork



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.

OperationDescription
deleteFileFromProjectDelete a file from a project.
getFileReturns a file.
getFilesOnAProjectReturns 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.

deleteFileFromProject
<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.

Sample request for deleteFileFromProject
{
    "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.

getFile
<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.

Sample request for getFile
{
    "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.

getFilesOnAProject
<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.

Sample request for getFilesOnAProject
{
    "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.

Sample proxy
<?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>