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 Projects in Redmine



Overview

The following operations allow you to work with projects. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with projects, see Sample configuration.

OperationDescription

createProject

Creates a project.

deleteProject

Deletes a project.

getProject

Returns a project.

listProjects

Lists all the projects.

updateProject

Updates a project.

Operation details

This section provides details on each of the operations.

 Creating a project

The createProject operation creates a project.

createProject
<redmine.createProject>
	<description>{$ctx:description}</description>
    <name>{$ctx:name}</name>
    <identifier>{$ctx:identifier}</identifier>
</redmine.createProject>
Properties
  • description: Description of the project.
  • name: Name of the project.
  • identifier: Identifier of the project.
Sample request

Following is a sample REST request that can be handled by the createProject operation.

Sample Request for createProject
 {
    "apiKey": "57d20676049c684a956a1sdf6f85930aeb0e31d796d",
    "apiUrl": "http://sample.m.redmine.org",
    "responseType": "json",
    "name": "testProject",
    "identifier": "test",
    "description": "testProject"    
}
Related Redmine documentation

http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Creating-a-project

Deleting a project

The deleteProject operation deletes a project of a given ID or identifier.

deleteProject
<redmine.deleteProject>
	<id>{$ctx:id}</id>
</redmine.deleteProject>
Properties
  • id: ID or identifier of the project to be deleted.
Sample request

Following is a sample REST request that can be handled by the deleteProject operation.

Sample Request for deleteProject
 {
	"apiKey":"445006e59d31f392ca7002sdfda0dcf66626471cfeb",
	"apiUrl":"http://sample.m.redmine.org",
	"responseType":"json",
	"id":"test"
}
Related Redmine documentation

http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Deleting-a-project

 Showing a project

The getProject operation returns a project of a given ID or identifier.

getProject
<redmine.getProject>
	<id>{$ctx:id}</id>
    <include>{$ctx:include}</include>
</redmine.getProject> 
Properties
  • id: ID or identifier of the project to be returned.
  • include: Optional - Fetch associated data. Possible values: trackers, issue_categories.
Sample request

Following is a sample REST request that can be handled by the getProject operation.

Sample Request for getProject
{
	"apiKey":"57d20676049c684a956a16fsdf85930aeb0e31d796d",
	"apiUrl":"http://sample.m.redmine.org",
	"responseType":"json",
	"id":"8",
	"include":"trackers,issue_categories"
} 
Related Redmine documentation

http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Showing-a-project

 Listing projects

The listProjects operation returns all the projects.

listProjects
 <redmine.listProjects/>
Sample request

Following is a sample REST request that can be handled by the listProjects operation.

Sample Request for listProjects
 {
	"apiKey":"57d20676049c684a956a16f85fds930aeb0e31d796d",
	"apiUrl":"http://sample.m.redmine.org",
	"responseType":"json"
}
Related Redmine documentation

http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Listing-projects

 Updating a project

The updateProject operation updates a project of a given ID or identifier.

updateProject
<redmine.updateProject>
	 <id>{$ctx:id}</id>
     <description>{$ctx:description}</description>
     <name>{$ctx:name}</name>
     <identifier>{$ctx:identifier}</identifier>
</redmine.updateProject>
Properties
  • id: ID of the project to be updated.
  • description: Description of the project.
  • name: Name of the project.
  • identifier: Identifier of the project.
Sample request

Following is a sample REST request that can be handled by the updateProject operation.

Sample Request for updateProject
 {
    "apiKey": "57d20676049c684a956a16dff85930aeb0e31d796d",
    "apiUrl": "http://sample.m.redmine.org",
    "responseType": "xml",
    "id": "8",
    "name": "Test",
    "identifier": "test-project",
    "description": "Tested"    
}
Related Redmine documentation

http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Updating-a-project

Sample configuration

Following is a sample proxy service that illustrates how to connect to Redmine with the init operation and use the createProject operation. The sample request for this proxy can be found in createProject sample request. You can use this sample as a template for using other operations in this category.

As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is "faultHandlerSeq". For more information, see /wiki/spaces/CONNECTORS/pages/48464453.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" 
	name="redmine_createProject" 
	transports="https,http" 
	statistics="disable" 
	trace="disable" 
	startOnLoad="true">
  <target>
    <inSequence onError="faultHandlerSeq">
      <property name="apiUrl" expression="json-eval($.apiUrl)"/>        
      <property name="apiKey" expression="json-eval($.apiKey)"/>
      <property name="responseType" expression="json-eval($.responseType)"/>	
      <property name="name" expression="json-eval($.name)"/>
      <property name="identifier" expression="json-eval($.identifier)"/>
      <property name="description" expression="json-eval($.description)"/>
	  <redmine.init>
        <apiUrl>{$ctx:apiUrl}</apiUrl>           
        <apiKey>{$ctx:apiKey}</apiKey>           
        <responseType>{$ctx:responseType}</responseType>
      </redmine.init>	  
      <redmine.createProject>
        <description>{$ctx:description}</description>
        <name>{$ctx:name}</name>
        <identifier>{$ctx:identifier}</identifier>
      </redmine.createProject>
		 <property name="messageType" value="application/json" scope="axis2"/>
         <filter source="$axis2:HTTP_SC" regex="^[^2][0-9][0-9]">
            <then>
               <switch source="$axis2:HTTP_SC">
                 <case regex="401">
                     <property name="ERROR_CODE" value="600401"/>					  
					 <property name="ERROR_MESSAGE" expression="json-eval($.Error.Code)"/>
                     <property name="error_description" expression="json-eval($.Error.Message)"/>
                  </case>
                  <case regex="404">
                     <property name="ERROR_CODE" value="600404"/>					  
					 <property name="ERROR_MESSAGE" expression="json-eval($.Error.Code)"/>
                     <property name="error_description" expression="json-eval($.Error.Message)"/>
                  </case>
				  <case regex="403">
                     <property name="ERROR_CODE" value="600403"/>					  
					 <property name="ERROR_MESSAGE" expression="json-eval($.Error.Code)"/>
                     <property name="error_description" expression="json-eval($.Error.Message)"/>
                  </case>
                  <case regex="422">
                     <property name="ERROR_CODE" value="600422"/>
                     <property name="ERROR_MESSAGE" expression="json-eval($.Error.Code)"/>                     
					 <property name="error_description" expression="//errors"/>
                  </case>				  
                  <case regex="400">
                     <property name="ERROR_CODE" value="600400"/>					  
					 <property name="ERROR_MESSAGE" expression="json-eval($.Error.Code)"/>
                     <property name="error_description" expression="json-eval($.Error.Message)"/>
                  </case>
                  <case regex="500">
                     <property name="ERROR_CODE" value="600500"/>  
					 <property name="ERROR_MESSAGE" expression="json-eval($.Error.Code)"/>
                     <property name="error_description" expression="json-eval($.Error.Message)"/>
                  </case>
                  <default> 
				     <property name="ERROR_CODE" expression="$axis2:HTTP_SC"/>
                     <property name="ERROR_MESSAGE" expression="json-eval($.Error.Code)"/>
                     <property name="error_description" expression="json-eval($.Error.Message)"/>
                  </default>
               </switch>
			<sequence key="faultHandlerSeq" />
            </then>
         </filter>
         <respond/>
      </inSequence>
      <outSequence>
		 <send/>
      </outSequence>
   </target>
   <description/>
</proxy>