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 JIRA

The following operations are available for working 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

getProject

Gets information about a project.

getAvatarsForProject

Gets all avatars available for a project that are visible to the current user.

deleteAvatarForProject

Deletes an avatar from a project.

getComponentsOfProject

Gets all the components of a project.

getStatusesOfProject

Gets the issue types and their valid status values for a project.

getVersionsOfProject

Gets all the versions of a project.

getRolesOfProject

Gets all the roles in a project.

getRolesByIdOfProject

Gets details on a specific role.

getUserAssignableProjects

Gets a list of users that match the search string.

setActorsToRoleOfProject Assigns users to a role in a project.

Following is more information about these operations.

Getting information about a project

To get information about a specific project, use getProject and specify the project key. This operation returns a JSON representation of the entire project, including name, ID, components, and more.

getProject
<jira.getProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
    <expand>{$ctx:expand}</expand>
</jira.getProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
  • expand : The parameters to expand.
Sample request

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

Sample request for getProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3008

 

Getting avatars for a project

To get the avatars available for a specific project, use getAvatarsForProject and specify the project key. This operation returns a JSON representation of the avatars, including their name, ID, and whether the avatar is currently selected for the project.

getAvatarsForProject
<jira.getAvatarsForProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
</jira.getAvatarsForProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
Sample request

Following is a sample REST/JSON request that can be handled by the getAvatarsForProject operation.

Sample request for getAvatarsForProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3151

Deleting an avatar from a project

To delete an avatar from a project, use deleteAvatarForProject and specify the project key and avatar ID.

deleteAvatarForProject
<jira.deleteAvatarForProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
	<avatarId>{$ctx:avatarId}</avatarId>
</jira.deleteAvatarForProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
  • avatarId: Identifies the avatar to delete.
Sample request

Following is a sample REST/JSON request that can be handled by the deleteAvatarForProject operation.

Sample request for deleteAvatarForProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST",
    "avatarId":"10412"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3175

Getting components of a project

To get the components of a specific project, use getComponentsOfProject and specify the project key. This operation returns a JSON representation of the components, including their name, ID, and avatars.

getComponentsOfProject
<jira.getComponentsOfProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
</jira.getComponentsOfProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
Sample request

Following is a sample REST/JSON request that can be handled by the getComponentsOfProject operation.

Sample request for getComponentsOfProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3218

Getting statuses of a project

To get the statuses of a specific project, usegetStatusesOfProject and specify the project key. This operation returns a JSON representation of each issue type in the project and their statuses.

getStatusesOfProject
<jira.getStatusesOfProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
</jira.getStatusesOfProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
Sample request

Following is a sample REST/JSON request that can be handled by the getStatusesOfProject operation.

Sample request for getStatusesOfProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3031

Getting versions of a project

To get the versions of a specific project, use getVersionsOfProject and specify the project key. This operation returns a JSON representation of the list of versions in the project.

getVersionsOfProject
<jira.getVersionsOfProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
</jira.getVersionsOfProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
Sample request

Following is a sample REST/JSON request that can be handled by the getVersionsOfProject operation.

Sample request for getVersionsOfProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3195

Getting roles of a project

To get the roles of a specific project, use getRolesOfProject and specify the project key. This operation returns a JSON representation of the list of roles in the project, including each role's name and a link to more details.

getRolesOfProject
<jira.getRolesOfProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
</jira.getRolesOfProject>
Properties
  • projectKey: The Identifier the project whose information you want to get.

Sample request

Following is a sample REST/JSON request that can be handled by the getRolesOfProject operation.

Sample request for getRolesOfProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1710

Getting information on a role

To get information about a specific role, use getRolesByIdOfProject and specify the project key and role ID. This operation returns a JSON representation of the role, including its name, ID, actors, and more.

getRolesByIdOfProject
<jira.getRolesByIdOfProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
	<roleId>{$ctx:roleId}</roleId>
</jira.getRolesByIdOfProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
  • roleId: Identifies the role whose information you want to get.
Sample request

Following is a sample REST/JSON request that can be handled by the getRolesByIdOfProject operation.

Sample request for getRolesByIdOfProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST",
    "roleId":"10001"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1731

 Returns a list of users can be assigned issues for all the given projects

To get list of users that match the search string and can be assigned issues for all the given projects, use getUserAssignableProjects

getUserAssignableProjects
<jira.getUserAssignableProjects>
    <projectKeys>{$ctx:projectKeys}</projectKeys>
	<usernameForSearch>{$ctx:usernameForSearch}</usernameForSearch>
    <maxResults>{$ctx:maxResults}</maxResults>
    <startAt>{$ctx:startAt}</startAt>
</jira.getUserAssignableProjects>
Properties
  • projectKeys : The keys of the projects we are finding assignable users for, comma-separated.
  • usernameForSearch : The username for search.
  • maxResults : The maximum number of users to return .
  • startAt : The index of the first user to return .
Sample request

Following is a sample REST/JSON request that can be handled by the getUserAssignableProjects operation.

Sample request for getUserAssignableProjects
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectKeys":"TEST",
    "usernameForSearch":"james"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3973

Assigning users to a role

To assign one or more users to a specific role in a project, use setActorsToRoleOfProject, specify the project key and role ID, and specify the users in the payload. You can specify individual users or groups.

setActorsToRoleOfProject
<jira.setActorsToRoleOfProject>
	<projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
    <roleId>{$ctx:roleId}</roleId>
    <roles>{$ctx:roles}</roles>
</jira.setActorsToRoleOfProject>
Properties
  • projectIdOrKey: The Identifier the project whose information you want to get.
  • roleId: Identifies the role whose information you want to get.
  • roles: The users who you want to assign.
Sample request

Following is a sample REST/JSON request that can be handled by the setActorsToRoleOfProject operation.

Sample request for setActorsToRoleOfProject
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "projectIdOrKey":"TEST",
    "projectKey":"JAF",
    "roleId":"10000",
    "roles":{"user" :["James"]}
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1731

Sample Configuration

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

Sample proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="setActorsToRoleOfProject"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="username" expression="json-eval($.username)"/>
         <property name="password" expression="json-eval($.password)"/>
         <property name="uri" expression="json-eval($.uri)"/>
         <property name="projectIdOrKey" expression="json-eval($.projectIdOrKey)"/>
         <property name="roleId" expression="json-eval($.roleId)"/>
         <property name="roles" expression="json-eval($.roles)"/>
         <jira.init>
            <username>{$ctx:username}</username>
            <password>{$ctx:password}</password>
            <uri>{$ctx:uri}</uri>
         </jira.init>
         <jira.setActorsToRoleOfProject>
            <projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
            <roleId>{$ctx:roleId}</roleId>
            <roles>{$ctx:roles}</roles>
         </jira.setActorsToRoleOfProject>
         <log level="full"/>
         <respond/>
      </inSequence>
      <outSequence/>
      <faultSequence/>
   </target>
   <description/>
</proxy>