Jira Data Center API

class JiraDataCenterAPI(base_url: str, api_username: str, api_token: str, configuration: jiratui.config.ApplicationConfiguration)

Bases: jiratui.api.api.JiraAPI

Implements the API exposed by the Jira Data Center (aka. on-premises) platform.

Initialization

API_PATH_PREFIX

‘/rest/api/2/’

See https://developer.atlassian.com/server/jira/platform/rest/v11001/intro/#structure

async search_projects(offset: int | None = None, limit: int | None = None, query: str | None = None, order_by: str | None = None, keys: list[str] = None) dict

Retrieves all projects visible for the currently logged-in user, i.e. all the projects the user has either ‘Browse projects’ or ‘Administer projects’ permission. If no user is logged in, it returns all projects that are visible for anonymous users.

See Also:

Parameters:
  • offset – N/A

  • limit – N/A

  • order_by – N/A

  • keys – N/A

  • query – N/A

Returns:

A dictionary with the details of the projects.

async search_issues(project_key: str | None = None, created_from: datetime.date | None = None, created_until: datetime.date | None = None, updated_from: datetime.date | None = None, updated_until: datetime.date | None = None, status: int | None = None, assignee: str | None = None, issue_type: int | None = None, jql_query: str | None = None, search_in_active_sprint: bool = False, fields: list[str] | None = None, next_page_token: str | None = None, offset: int | None = None, limit: int | None = None, order_by: jiratui.models.WorkItemsSearchOrderBy | None = None) dict

Searches for issues using JQL. Recent updates might not be immediately visible in the returned search results.

See Also:

Parameters:
  • project_key – search items that belong to the project with this (case-sensitive) key.

  • created_from – search items created from this date forward.

  • created_until – search items created until this date.

  • updated_from – search items updated from this date forward.

  • updated_until – search items updated until this date

  • status – search items with this status id.

  • assignee – search items assigned to this user (by account id).

  • issue_type – search items with this type id.

  • jql_query – a JQL expression to filter items.

  • search_in_active_sprint – if True only work items that belong to the currently active sprint will be retrieved.

  • fields – retrieve these fields for every item found.

  • next_page_token – N/A

  • offset – the index of the first issue to return (0-based)

  • limit – retrieve this max number of results per page.

  • order_by – sort the items according to these criteria. This requirement needs to be placed at the end of the JQL query, otherwise the JQL will be invalid. Possible values are: - order by created asc - order by created desc - order by priority asc - order by priority desc - order by key asc - order by key desc

Returns:

A dictionary with the results.

abstractmethod async work_items_search_approximate_count(project_key: str | None = None, created_from: datetime.date | None = None, created_until: datetime.date | None = None, updated_from: datetime.date | None = None, status: int | None = None, assignee: str | None = None, issue_type: int | None = None, jql_query: str | None = None) dict
async server_info() dict

Retrieves information of the Jira server.

See Also:

Returns:

A dictionary with the details.

async myself() dict

Retrieves information of the Jira user connecting to the Jira server.

See Also:

Returns:

A dictionary with the details.

Retrieves a list of active users that match the search string and property.

See Also:

Parameters:
  • username – A query string used to search username, name or e-mail address.

  • query – N/A.

  • offset – the index of the first item to return.

  • limit – the maximum number of items to return (limited to 1000).

Returns:

A list of dictionaries with the details of the users.

async user_assignable_multi_projects(project_keys: list[str] = None, query: str | None = None, offset: int | None = None, limit: int | None = None) list[dict]

Retrieves the users who can be assigned issues in one or more projects.

See Also:

Parameters:
  • project_keys – a list of project keys (case-sensitive). This parameter accepts a comma-separated list.

  • offset – N/A

  • limit – the maximum number of items to return per page. Default is 50.

  • query – expects a username. Required, unless username or accountId is specified.

Returns:

A list of dictionaries with the details of the users.

async get_attachment(attachment_id: str) dict

Retrieves an attachment (metadata).

See Also:

Parameters:

attachment_id – the ID of the attachment.

Returns:

JSON representation of the attachment meta-data. The representation does not contain the attachment itself, but contains a URI that can be used to download the actual attached file.

async get_attachment_content(attachment_id: str) Any

Retrieves the contents of an attachment.

See Also:

Parameters:

attachment_id – The ID of the attachment.

Returns:

A bytes representation of the attachment’s content; or None if the attachment can not be downloaded.

async get_issue_work_log(issue_id_or_key: str, offset: int | None = None, limit: int | None = None) dict

Retrieves all work logs for an issue. Work logs won’t be returned if the Log work field is hidden for the project.

See Also:

Parameters:
  • issue_id_or_key – the case-sensitive key of the work item.

  • offset – N/A.

  • limit – N/A.

Returns:

A dictionary with the worklog of the work item.

async add_issue_work_log(issue_id_or_key: str, time_spent: str, started: datetime.datetime, time_remaining: str | None = None, comment: str | None = None) dict

Adds a worklog to an issue.

See Also:

Parameters:
  • issue_id_or_key – the case-sensitive key of the work item.

  • comment – a comment about the worklog. Optional when creating or updating a worklog.

  • started – the datetime on which the worklog effort was started. Required when creating a worklog. Optional when updating a worklog.

  • time_spent – the time spent working on the issue as days (#d), hours (#h), or minutes (#m or #). Required when creating a worklog if timeSpentSeconds isn’t provided. Optional when updating a worklog. Cannot be provided if timeSpentSecond is provided.

  • time_remaining – required when ‘new’ is selected for adjustEstimate. e.g. “2d”.

Returns:

A dictionary with the worklog’s details.