Skip to content

Latest commit

 

History

History
536 lines (399 loc) · 22.8 KB

ProjectRolesApi.md

File metadata and controls

536 lines (399 loc) · 22.8 KB

ProjectRolesApi

All URIs are relative to https://your-domain.atlassian.com

Method HTTP request Description
createProjectRole POST /rest/api/3/role Create project role
deleteProjectRole DELETE /rest/api/3/role/{id} Delete project role
fullyUpdateProjectRole PUT /rest/api/3/role/{id} Fully update project role
getAllProjectRoles GET /rest/api/3/role Get all project roles
getProjectRole GET /rest/api/3/project/{projectIdOrKey}/role/{id} Get project role for project
getProjectRoleById GET /rest/api/3/role/{id} Get project role by ID
getProjectRoleDetails GET /rest/api/3/project/{projectIdOrKey}/roledetails Get project role details
getProjectRoles GET /rest/api/3/project/{projectIdOrKey}/role Get project roles for project
partialUpdateProjectRole POST /rest/api/3/role/{id} Partial update project role

createProjectRole

ProjectRole createProjectRole(body)

Create project role

Creates a new project role with no default actors. You can use the Add default actors to project role operation to add default actors to the project role after creating it. Note that although a new project role is available to all projects upon creation, any default actors that are associated with the project role are not added to projects that existed prior to the role being created.< Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
CreateUpdateRoleRequestBean body = new CreateUpdateRoleRequestBean(); // CreateUpdateRoleRequestBean | 
try {
    ProjectRole result = apiInstance.createProjectRole(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#createProjectRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body CreateUpdateRoleRequestBean

Return type

ProjectRole

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteProjectRole

deleteProjectRole(id, swap)

Delete project role

Deletes a project role. You must specify a replacement project role if you wish to delete a project role that is in use. Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
Long id = 789L; // Long | The ID of the project role to delete. Use [Get all project roles](#api-rest-api-3-role-get) to get a list of project role IDs.
Long swap = 789L; // Long | The ID of the project role that will replace the one being deleted.
try {
    apiInstance.deleteProjectRole(id, swap);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#deleteProjectRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The ID of the project role to delete. Use Get all project roles to get a list of project role IDs.
swap Long The ID of the project role that will replace the one being deleted. [optional]

Return type

null (empty response body)

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

fullyUpdateProjectRole

ProjectRole fullyUpdateProjectRole(body, id)

Fully update project role

Updates the project role's name and description. You must include both a name and a description in the request. Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
CreateUpdateRoleRequestBean body = new CreateUpdateRoleRequestBean(); // CreateUpdateRoleRequestBean | 
Long id = 789L; // Long | The ID of the project role. Use [Get all project roles](#api-rest-api-3-role-get) to get a list of project role IDs.
try {
    ProjectRole result = apiInstance.fullyUpdateProjectRole(body, id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#fullyUpdateProjectRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body CreateUpdateRoleRequestBean
id Long The ID of the project role. Use Get all project roles to get a list of project role IDs.

Return type

ProjectRole

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getAllProjectRoles

List<ProjectRole> getAllProjectRoles()

Get all project roles

Gets a list of all project roles, complete with project role details and default actors. ### About project roles ### Project roles are a flexible way to to associate users and groups with projects. In Jira Cloud, the list of project roles is shared globally with all projects, but each project can have a different set of actors associated with it (unlike groups, which have the same membership throughout all Jira applications). Project roles are used in permission schemes, email notification schemes, issue security levels, comment visibility, and workflow conditions. #### Members and actors #### In the Jira REST API, a member of a project role is called an actor. An actor is a group or user associated with a project role. Actors may be set as default members of the project role or set at the project level: * Default actors: Users and groups that are assigned to the project role for all newly created projects. The default actors can be removed at the project level later if desired. * Actors: Users and groups that are associated with a project role for a project, which may differ from the default actors. This enables you to assign a user to different roles in different projects. Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
try {
    List<ProjectRole> result = apiInstance.getAllProjectRoles();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#getAllProjectRoles");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

List<ProjectRole>

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getProjectRole

ProjectRole getProjectRole(projectIdOrKey, id)

Get project role for project

Returns a project role's details and actors associated with the project. The list of actors is sorted by display name. To check whether a user belongs to a role based on their group memberships, use Get user with the `groups` expand parameter selected. Then check whether the user keys and groups match with the actors returned for the project. This operation can be accessed anonymously. Permissions required: Administer Projects project permission for the project or Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
String projectIdOrKey = "projectIdOrKey_example"; // String | The project ID or project key (case sensitive).
Long id = 789L; // Long | The ID of the project role. Use [Get all project roles](#api-rest-api-3-role-get) to get a list of project role IDs.
try {
    ProjectRole result = apiInstance.getProjectRole(projectIdOrKey, id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#getProjectRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
projectIdOrKey String The project ID or project key (case sensitive).
id Long The ID of the project role. Use Get all project roles to get a list of project role IDs.

Return type

ProjectRole

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getProjectRoleById

ProjectRole getProjectRoleById(id)

Get project role by ID

Gets the project role details and the default actors associated with the role. The list of default actors is sorted by display name. Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
Long id = 789L; // Long | The ID of the project role. Use [Get all project roles](#api-rest-api-3-role-get) to get a list of project role IDs.
try {
    ProjectRole result = apiInstance.getProjectRoleById(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#getProjectRoleById");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The ID of the project role. Use Get all project roles to get a list of project role IDs.

Return type

ProjectRole

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getProjectRoleDetails

List<ProjectRoleDetails> getProjectRoleDetails(projectIdOrKey, currentMember, excludeConnectAddons)

Get project role details

Returns all project roles and the details for each role. Note that the list of project roles is common to all projects. This operation can be accessed anonymously. Permissions required: Administer Jira global permission or Administer projects project permission for the project.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
String projectIdOrKey = "projectIdOrKey_example"; // String | The project ID or project key (case sensitive).
Boolean currentMember = false; // Boolean | Whether the roles should be filtered to include only those the user is assigned to.
Boolean excludeConnectAddons = false; // Boolean | 
try {
    List<ProjectRoleDetails> result = apiInstance.getProjectRoleDetails(projectIdOrKey, currentMember, excludeConnectAddons);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#getProjectRoleDetails");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
projectIdOrKey String The project ID or project key (case sensitive).
currentMember Boolean Whether the roles should be filtered to include only those the user is assigned to. [optional] [default to false]
excludeConnectAddons Boolean [optional] [default to false]

Return type

List<ProjectRoleDetails>

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getProjectRoles

Map<String, String> getProjectRoles(projectIdOrKey)

Get project roles for project

Returns a list of project roles for the project returning the name and self URL for each role. Note that all project roles are shared with all projects in Jira Cloud. See Get all project roles for more information. This operation can be accessed anonymously. Permissions required: Administer Projects project permission for any project on the site or Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
String projectIdOrKey = "projectIdOrKey_example"; // String | The project ID or project key (case sensitive).
try {
    Map<String, String> result = apiInstance.getProjectRoles(projectIdOrKey);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#getProjectRoles");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
projectIdOrKey String The project ID or project key (case sensitive).

Return type

Map<String, String>

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

partialUpdateProjectRole

ProjectRole partialUpdateProjectRole(body, id)

Partial update project role

Updates either the project role's name or its description. You cannot update both the name and description at the same time using this operation. If you send a request with a name and a description only the name is updated. Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.ProjectRolesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

ProjectRolesApi apiInstance = new ProjectRolesApi();
CreateUpdateRoleRequestBean body = new CreateUpdateRoleRequestBean(); // CreateUpdateRoleRequestBean | 
Long id = 789L; // Long | The ID of the project role. Use [Get all project roles](#api-rest-api-3-role-get) to get a list of project role IDs.
try {
    ProjectRole result = apiInstance.partialUpdateProjectRole(body, id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ProjectRolesApi#partialUpdateProjectRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body CreateUpdateRoleRequestBean
id Long The ID of the project role. Use Get all project roles to get a list of project role IDs.

Return type

ProjectRole

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json