API Documentation¶
endpoint¶
This is an alias to the EndPoints
class and it has many methods that can be called directly.
You can access this classmethod by calling jiraone.endpoint
.
from jiraone import LOGIN
user = "email"
password = "token"
link = "https://yourinstance.atlassian.net"
LOGIN(user=user, password=password, url=link)
def priorities():
load = LOGIN.get(endpoint.get_all_priorities())
if load.status_code == 200:
# some expression here
...
- class jiraone.access.EndPoints¶
A Structural way to dynamically load urls that is fed to other functions.
- classmethod add_customers(service_desk_id)¶
Adds one or more customers to a service desk.
If any of the passed customers are associated with the service desk, no changes will be made for those customers and the resource returns a 204 success code.
- Request POST
- Parameters
service_desk_id – required
- Body param
usernames, accountIds, datatype -> Array<string>
- Returns
A string of the url
- Return type
str
- classmethod add_sd_organization(service_desk_id)¶
This method adds an organization to a service desk.
If the organization ID is already associated with the service desk, no change is made and the resource returns a 204 success code.
- Request POST
- Parameters
service_desk_id – required
- Body param
organizationId, datatype -> integer
- Returns
A string of the url
- Return type
str
- classmethod add_users_to_organization(org_id)¶
This method adds users to an organization.
- Request POST
- Parameters
org_id – required
- Body param
usernames, accountIds, datatypes -> Array<string>
- Returns
A string of the url
- Return type
str
- classmethod comment(query=None, key_or_id=None, start_at=0, max_results=50, ids=None, event=False)¶
Create, update, delete or get a comment.
- Request POST
Returns a paginated list of just the comments for a list
of comments specified by comment IDs.
- Parameters
query (Optional[str]) – datatype -> string
key_or_id (Optional[str]) –
start_at (int) –
max_results (int) –
ids (Optional[int]) –
event (bool) –
- Query param
expand datatype -> string
available options below
renderedBody Returns the comment body rendered in HTML.
properties Returns the comment’s properties.
- Body param - ids
datatype -> Array<integer>
The list of comment IDs. A maximum of 1000 IDs can be specified.
- Request GET
Returns all comments for an issue.
- param key_or_id
datatype -> string required
- param start_at
datatype -> integer defaults to 0
- param max_results
datatyoe -> integer defaults to 50
- Query param
orderBy datatype -> string Valid values: created, -created, +created
- Request POST
Adds a comment to an issue.
key_or_id required
- :param event datatype -> boolean
defaults to false, set to true to add a comment to an issue.
- query param
expand
- body param
body datatype -> Anything visibility -> The group or role to which this comment is visible. Optional on create and update. properties datatype -> Array<EntityProperty>
A list of comment properties. Optional on create and update. Additional Properties datatype ->anything
- Request GET
Returns a comment.
- param ids
datatype integers - The ID of the comment.
- query param
expand
- Request PUT
Updates a comment.
- key_or_id required
ids The ID of the comment.
- query param
expand
- body param
body datatype -> Anything visibility -> The group or role to which this comment is visible. Optional on create and update.
- properties datatype -> Array<EntityProperty>
A list of comment properties. Optional on create and update.
Additional Properties datatype ->anything
- Request DELETE
Deletes a comment.
- key_or_id required
ids required
- Returns
A string of the url
- Return type
str
- classmethod create_board()¶
Creates a new board. Board name, type and filter ID is required.
- Request GET
returns a list of boards on the instance that’s accessible by
- Return type
str
you.
- Request POST
- Body param
name, type, datatype -> string
filterId, datatype -> integer
location, datatype -> object
- Returns
A string of the url
- Return type
str
- classmethod create_customer()¶
This method adds a customer to the Jira Service Management.
instance by passing a JSON file including an email address and display name.
- Request POST
- Body param
email, displayName, datatype -> string
- Returns
A string of the url
- Return type
str
- classmethod create_organization()¶
This method creates an organization by passing the name of the organization.
- Request POST
- Body param
name, datatype -> string
- Returns
A string of the url
- Return type
str
- classmethod create_sprint()¶
Creates a future sprint. Sprint name and origin board id are required.
Start date, end date, and goal are optional.
- Request POST
- Body param
name, startDate, endDate, goal, datatype -> string : originBoardId, datatype -> integer
- Returns
A string of the url
- Return type
str
- classmethod delete_organization(org_id)¶
This method deletes an organization.
Note that the organization is deleted regardless of other associations it may have. For example, associations with service desks.
- Request DELETE
- Parameters
org_id – required
- Returns
A string of the url
- Return type
str
- classmethod delete_sprint(sprint_id)¶
Deletes a sprint.
Once a sprint is deleted, all open issues in the sprint will be moved to the backlog.
- Request DELETE
- Parameters
sprint_id – required
- Returns
A string of the url
- Return type
str
- classmethod find_users_with_permission(*args)¶
Find users with permissions to a Project.
- Parameters
args – 1st accountId, 2nd projectKey, 3rd permissions that needs checking all in caps e.g “BROWSE”, “CREATE_ISSUE” etc
- Returns
A string of the url
- Return type
str
- classmethod get_all_application_role()¶
Returns all application roles.
In Jira, application roles are managed using the Application access configuration page.
- Returns
A string of the url
- Return type
str
- classmethod get_all_issue_security_scheme()¶
Returns all issue security schemes.
- Returns
A string of the url
- Return type
str
- classmethod get_all_issue_type_schemes(query=None, start_at=0, max_results=50)¶
- Returns a paginated list of issue type schemes.
Only issue type schemes used in classic projects are returned
- Parameters
query (Optional[str]) – A search term
start_at – A row record
max_results – A maximum number to display
- Returns
A string of the url
- Return type
str
- classmethod get_all_issue_types()¶
Returns all issue types.
If the user has the Administer Jira global permission, all issue types are returned.
If the user has the Browse projects project permission for one or more projects, the issue types associated with the projects the user has permission to browse are returned.
- Returns
A string of the url
- Return type
str
- classmethod get_all_permission_scheme(query=None)¶
Returns all permission schemes.
- Parameters
query (Optional[str]) – A search term for this resource.
- Returns
A string of the url
- Return type
str
- classmethod get_all_priorities()¶
Returns the list of all issue priorities.
- Returns
A string of the url
- Return type
str
- classmethod get_all_quick_filters(board_id, start_at=0, max_results=50)¶
Returns all quick filters from a board, for a given board ID.
- Parameters
board_id – required
start_at (int) – defaults 0
max_results (int) – defaults 50
- Returns
A string of the url
- Return type
str
- classmethod get_all_sprints(board_id, query=None, start_at=0, max_results=50)¶
Get all Sprint on a Board.
- Parameters
board_id – A board id
start_at (int) – defaults to 0
max_results (int) – defaults to 50
query (Optional[str]) – A search term
- Returns
A string of the url
- Return type
str
- classmethod get_attachment_meta_data(query, warning=None)¶
Returns the metadata for an attachment. Note that the attachment itself is not returned.
- Parameters
query (str) – of the attachment
warning (Optional[Any]) – deprecation notice
- Return type
str
Use issue search endpoint in conjunction to grab the attachment id
- Returns
A string of the url
- Parameters
query (str) –
warning (Optional[Any]) –
- Return type
str
- classmethod get_board(board_id)¶
Returns the board for the given board ID.
This board will only be returned if the user has permission to view it. Admins without the view permission will see the board as a private one, so will see only a subset of the board’s data (board location for instance).
- Parameters
board_id – A board id
- Returns
A string of the url
- Return type
str
- classmethod get_board_by_filter_id(filter_id, start_at=0, max_results=50)¶
Returns any boards which use the provided filter id.
This method can be executed by users without a valid software license in order to find which boards are using a particular filter.
- Parameters
filter_id – required - Filters results to boards that are relevant to a filter.
start_at (int) –
max_results (int) –
- Return type
str
Not supported for next-gen boards.
- Parameters
start_at (int) – defaults to 0
max_results (int) – defaults to 50
- Returns
A string of the url
- Return type
str
- classmethod get_customers(service_desk_id, start=0, limit=50, query=None)¶
This method returns a list of the customers on a service desk.
The returned list of customers can be filtered using the query parameter. The parameter is matched against customers’ displayName, name, or email. This API is experimental
- Parameters
service_desk_id – required
start (int) – defaults to 0
limit (int) – defaults to 50
query (Optional[str]) – datatype string.
- Returns
A string of the url
- Return type
str
- classmethod get_dashboard(dashboard_id)¶
Gets the dashboard.
- Parameters
dashboard_id (int) – An id for the dashboard
- Returns
A string of the url
- Return type
str
- classmethod get_field(query=None, start_at=0, max_results=50, system=None)¶
Returns a paginated list of fields for Classic Jira projects. The list can include:
all fields.
specific fields, by defining id.
fields that contain a string in the field name or description, by defining query.
specific fields that contain a string in the field name or description, by defining id and query.
Only custom fields can be queried, type must be set to custom.
Find system fields
Fields that cannot be added to the issue navigator are always returned.
Fields that cannot be placed on an issue screen are always returned.
Fields that depend on global Jira settings are only returned if the setting is enabled. That is, timetracking fields, subtasks, votes, and watches.
For all other fields, this operation only returns the fields that the user has permission to view
(that is, the field is used in at least one project that the user has Browse Projects project permission for.)
- Parameters
query (Optional[str]) – accepted options -> string type=custom (use to search for custom fields)
start_at (int) – defaults to 0
max_results (int) – defaults to 50
system (Optional[str]) –
string accepts any string e.g. field (use any string to denote as system)
- return
A string of the url
- Return type
str
- classmethod get_issues_on_backlog(board_id, query=None, start_at=0, max_results=50)¶
Returns all issues from the board’s backlog, for the given board ID.
This only includes issues that the user has permission to view. The backlog contains incomplete issues that are not assigned to any future or active sprint.
- Parameters
board_id – required
start_at (int) – defaults to 0,
max_results (int) – defaults to 50
query (Optional[str]) –
-> includes other query parameters such as
Query Datatypes
jql | string validateQuery | boolean fields | Array<string> expand | string
- Returns
A string of the url
- Return type
str
- classmethod get_issues_on_board(board_id, query=None, start_at=0, max_results=50)¶
Returns all issues from a board, for a given board ID.
This only includes issues that the user has permission to view. An issue belongs to the board if its status is mapped to the board’s column.
- Parameters
board_id – required
start_at (int) – defaults to 0,
max_results (int) – defaults to 50
query (Optional[str]) –
-> includes other query parameters such as
Query Datatypes
jql | string validateQuery | boolean fields | Array<string> expand | string
- Returns
A string of the url
- Return type
str
- classmethod get_organization(org_id)¶
This method returns details of an organization.
Use this method to get organization details whenever your application component is passed an organization ID but needs to display other organization details.
- Parameters
org_id – required
- Returns
A string of the url
- Return type
str
- classmethod get_organizations(start=0, limit=50, account_id=None)¶
This method returns a list of organizations in the Jira Service Management instance.
Use this method when you want to present a list of organizations or want to locate an organization by name.
- Parameters
start (int) – defaults to 0
limit (int) – defaults to 50
account_id (Optional[str]) – datatype string. e.g. 5b10ac8d82e05b22cc7d4ef5
- Returns
A string of the url
- Return type
str
- classmethod get_project_component(id_or_key)¶
Returns all components in a project. See the Get project components paginated
resource if you want to get a full list of components with pagination. The project ID or project key (case sensitive).
- Parameters
id_or_key – An issue key or id
- Returns
A string of the url
- Return type
str
- classmethod get_project_role(*args)¶
Returns a project role’s details and actors associated with the project.
- Parameters
args – projectKey or Id of the Project id of the role
- Returns
A string of the url
- Return type
str
- classmethod get_projects(*args, start_at=0, max_results=50)¶
Return a list of Projects available on an Instance
How to use this endpoint
/rest/api/3/project/search
is mentioned- param args
Query Parameters that are useful mostly.
query, example: query=key,name {caseInsensitive}
searchBy, example: searchBy=key,name
action, example: action=browse
available options [view, browse, edit]
status example: status=live
available options [live, archived, deleted]
e). expand, example: expand=insight
available options [insight, description, projectKeys, url, issueTypes, lead]
- param start_at
defaults as keyword args,example startAt=0
- param max_results
defaults as keyword args, example maxResults=50
- return
A string of the url
- Parameters
args (Any) –
- Return type
str
- classmethod get_projects_on_board(board_id, start_at=0, max_results=50)¶
Returns all projects that are associated with the board, for the given board ID.
If the user does not have permission to view the board, no projects will be returned at all. Returned projects are ordered by the name.
- Parameters
board_id – required
start_at (int) – defaults 0
max_results (int) – defaults 50
- Returns
A string of the url
- Return type
str
- classmethod get_quick_filter(board_id, quick_filter_id)¶
Returns the quick filter for a given quick filter ID.
The quick filter will only be returned if the user can view the board that the quick filter belongs to.
- Parameters
board_id – required,
quick_filter_id – required
- Returns
A string of the url
- Return type
str
- classmethod get_resolutions()¶
Returns a list of all issue resolution values. :return: A string of the url
- Return type
str
- classmethod get_roles_for_project(id_or_key)¶
Returns a list of project roles for the project returning the name and self URL for each role.
- Parameters
id_or_key (Any) – An issue key or id
- Returns
A string of the url
- Return type
str
- classmethod get_sd_by_id(service_desk_id)¶
This method returns a service desk. Use this method to get service desk details whenever your application component is passed a service desk ID but needs to display other service desk details.
- Parameters
service_desk_id – The ID of the service desk to return. Required
- Returns
string
- Return type
str
- classmethod get_sd_organizations(service_desk_id, start=0, limit=50, account_id=None)¶
This method returns a list of all organizations associated with a service desk.
- Parameters
service_desk_id – required
start (int) – defaults to 0
limit (int) – defaults to 50
account_id (Optional[str]) – datatype string. e.g. 5b10ac8d82e05b22cc7d4ef5
- Returns
A string of the url
- Return type
str
- classmethod get_server_info()¶
This method retrieves information about the Jira Service Management.
instance such as software version, builds, and related links.
- Returns
A string of the url
- Return type
str
- classmethod get_service_desks(start=0, limit=100)¶
This method returns all the service desks in the Jira Service Management instance that the user has permission to access. Use this method where you need a list of service desks or need to locate a service desk by name or keyword.
- Parameters
start (int) – integer - pagination row
limit (int) – integer - limit to each pagination
- Returns
string
- Return type
str
- classmethod get_sprint(sprint_id)¶
Returns the sprint for a given sprint ID.
The sprint will only be returned if the user can view the board that the sprint was created on, or view at least one of the issues in the sprint.
- Parameters
sprint_id – required
- Returns
A string of the url
- Return type
str
- classmethod get_user_group(account_id)¶
Search for the groups a user belongs to
- Parameters
account_id (Any) – An alphanumeric required string
- Returns
A string of the url
- Return type
str
- classmethod get_users_in_organization(org_id, start=0, limit=50)¶
This method returns all the users associated with an organization.
Use this method where you want to provide a list of users for an organization or determine if a user is associated with an organization.
- Parameters
org_id – required
start (int) – datatype integer
limit (int) – datatype integer
- Returns
A string of the url
- Return type
str
- classmethod group_jira_users(group_name, account_id=None)¶
Used for addition and removal of users to and from groups.
- request POST
Adds a user to a group.
- query param
groupname required, datatype -> string
- body param
name, accountId, datatype -> string returns 201 if successful
- request DELETE
Removes a user from a group.
- query param
group_name required, account_id required, datatype -> string returns 200 if successful
- Parameters
group_name (str) – name of group
account_id (Optional[str]) –
string of a user account
- return
A string of the url
- Return type
str
- classmethod instance_info()¶
Returns licensing information about the Jira instance.
- classmethod issue_attachments(id_or_key=None, attach_id=None, uri=None, query=None)¶
Returns the attachment content.
- request GET
Get Jira attachment settings
Returns the attachment settings, that is, whether attachments are enabled and the maximum attachment size allowed.
- request GET
Get attachment Meta data
Returns the metadata for an attachment. Note that the attachment itself is not returned.
- param attach_id
required (id of the attachment), datatype -> string
- request DELETE
Deletes an attachment from an issue.
attach_id required (id of the attachment), datatype -> string
- Request GET
Get all metadata for an expanded attachment
- Parameters
query (Optional[str]) –
datatype -> string
available options
- expand/human -Returns the metadata for the contents of an attachment, if it is an archive,
and metadata for the attachment itself. For example, if the attachment is a ZIP archive, then information about the files in the archive is returned and metadata for the ZIP archive.
- expand/raw - Returns the metadata for the contents of an attachment, if it is an archive.
For example, if the attachment is a ZIP archive, then information about the files in the archive is returned. Currently, only the ZIP archive format is supported.
id_or_key (Optional[str]) –
attach_id (Optional[str]) –
uri (Optional[str]) –
- Request POST
Adds one or more attachments to an issue. Attachments are posted as multipart/form-data
- request POST
Adds one or more attachments to an issue. Attachments are posted as multipart/form-data
- param id_or_key
required, datatype -> string. The ID or key of the issue that attachments are added to.
- param uri
various endpoint to attachment
- return
A string of the url
- Return type
str
- classmethod issue_export(url=None, start=0, limit=1000)¶
Generate an export of Jira issues using a JQL.
- Parameters
url (Optional[str]) – A JQL of the issues to be exported
start (int) – A start counter
limit (int) – Max limit allowed for export
- Returns
A string of the export URL
- Return type
str
- classmethod issue_link(link_id=None)¶
Use this operation to indicate a relationship between two issues and optionally add a comment to the from (outward) issue.
- Request GET
Returns an issue link.
- Request POST
Creates a link between two issues. link_id required.
- Request DELETE
Deletes an issue link. link_id required.
- Parameters
link_id (Optional[str]) – The ID of the issue link.
- Returns
str
- Return type
str
- classmethod issue_votes(key_or_id=None)¶
Return the number of votes on an issue
- Request GET
Returns details about the votes on an issue.
- Request POST
Adds the user’s vote to an issue.
- Request DELETE
Deletes a user’s vote from an issue.
- Parameters
key_or_id (Optional[str]) – The ID or key of the issue.
- Returns
str
- Return type
str
- classmethod issue_watchers(key_or_id=None, account_id=None)¶
This operation requires the Allow users to watch issues option to be ON.
- Request GET
Returns the watchers for an issue.
- Request POST
Adds a user as a watcher of an issue by passing the account ID of the user.
- Request DELETE
Deletes a user as a watcher of an issue.
- Parameters
key_or_id (Optional[str]) – The ID or key of the issue.
account_id (Optional[str]) – The account ID of the user
- Request POST
Returns, for the user, details of the watched status of issues from a list. :body param: issueIds - List[int]
- Returns
str
- Return type
str
- classmethod issues(issue_key_or_id=None, query=None, uri=None, event=False)¶
Creates issues, delete issues, bulk create issue, transitions.
A transition may be applied, to move the issue or subtask to a workflow step other than the default start step, and issue properties set.
- Request POST
Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask.
- Parameters
uri (Optional[str]) –
datatype -> string
available options [bulk, createmeta]
e.g. endpoint:
/rest/api/3/issue/bulk
e.g. endpoint
/rest/api/3/issue/createmeta
query (Optional[Any]) –
datatype -> string
use the query keyword argument and structure a parameter
e.g. query=”notifyUsers=false”
OR in the case of changelog the endpoint of “changelog”
event (bool) –
datatype -> boolean
determine if you can get a changelog from the issue. default is false
if True required parameters are:
issue_key_or_id (Optional[Any]) –
query –
/rest/api/3/issue/{issueIdOrKey}/changelog
issue_key_or_id –
-> string or integer
The body parameter has to be a bundled data that should be posted to the desired endpoint.
- Query param
updateHistory, datatype -> boolean
- Body param
transition, fields, update, historyMetadata, datatype -> object : properties, datatype -> Array<EntityProperty> : Additional Properties, datatype -> Any
- Request POST
Bulk create issue
- Return type
str
Creates issues and, where the option to create subtasks is enabled in Jira, subtasks.
- Body param
issueUpdates, datatype -> Array<IssueUpdateDetails> : Additional Properties, datatype -> Any
- Request GET
Create issue metadata
- Parameters
issue_key_or_id (Optional[Any]) –
query (Optional[Any]) –
uri (Optional[str]) –
event (bool) –
- Return type
str
Returns details of projects, issue types within projects, and, when requested, the create screen fields for each issue type for the user.
- Query param
projectIds, projectKeys, issuetypeIds, issuetypeNames, datatype -> Array<string> : expand, datatype -> string
- Request GET
Get issue. Return the details of an issue endpoint
/rest/api/3/issue/{issueIdOrKey}
- Query param
issue_key_or_id required fields, properties, datatype -> Array<string> fieldsByKeys, updateHistory, datatype -> boolean expand, datatype -> string
- Request PUT
Edits an issue. A transition may be applied and issue properties
updated as part of the edit. endpoint /rest/api/3/issue/{issueIdOrKey}
- Query param
issue_key_or_id required : notifyUsers, overrideScreenSecurity, overrideEditableFlag, datatype -> boolean
- Body param
transition, fields, update, historyMetadata, properties, Additional Properties, datatype -> object
- Request DELETE
Deletes an issue. endpoint
/rest/api/3/issue/{issueIdOrKey}
- Query param
issue_key_or_id required : deleteSubtasks, datatype -> string, values = (true | false)
- Returns
A string of the url
- Parameters
issue_key_or_id (Optional[Any]) –
query (Optional[Any]) –
uri (Optional[str]) –
event (bool) –
- Return type
str
- classmethod jira_group(group_name=None, swap_group=None)¶
Used for Creation and deletion of Jira groups.
- Request POST
Creates a group.
- body param
name required, datatype -> string returns 201 if successful
- Request DELETE
Deletes a group.
- The group to transfer restrictions to. Only comments and worklogs are transferred.
If restrictions are not transferred, comments and worklogs are inaccessible after the deletion.
- query param
group_name required, swap_group, datatype -> string returns 200 if successful
- Parameters
group_name (Optional[str]) – name of group
swap_group (Optional[str]) – group name to swap
- Returns
A string of the url
- Return type
str
- classmethod jira_user(account_id=None)¶
API for User creation, deletion and retrieval.
- Request POST
Creates a user. This resource is retained for legacy compatibility.
As soon as a more suitable alternative is available this resource will be deprecated
- Body param
key, name, password, emailAddress, displayName, notification, datatypes -> string : applicationKeys, datatype -> Array<string> : Additional Properties, datatypes -> Any returns 201 for successful creation
- Request DELETE
Deletes a user.
- Body param
accountId, datatype -> string required returns 204 for successful deletion
- Request GET
Returns a user.
- Body param
accountId, expand, datatypes -> string
- Parameters
account_id (Optional[str]) –
string for a user account
- Returns
A string of the url
- Return type
str
- classmethod move_issues_to_backlog()¶
Move issues to the backlog.
This operation is equivalent to remove future and active sprints from a given set of issues. At most 50 issues may be moved at once.
- Request POST
- Body param
issues, datatype -> Array<string>
- Return type
str
Send a POST request within API.
- Returns
A string of the url
- Return type
str
- classmethod move_issues_to_backlog_from_board(board_id)¶
Move issues to the backlog of a particular board (if they are already on that board).
This operation is equivalent to remove future and active sprints from a given set of issues if the board has sprints If the board does not have sprints this will put the issues back into the backlog from the board. At most 50 issues may be moved at once.
- Request POST
- Parameters
board_id – required
- Body param
issues, datatype -> Array<string>,
rankBeforeIssue, rankAfterIssue, type -> string
rankCustomFieldId, type -> integer
- Returns
A string of the url
- Return type
str
- classmethod move_issues_to_board(board_id)¶
Move issues from the backog to the board (if they are already in the backlog of that board).
This operation either moves an issue(s) onto a board from the backlog (by adding it to the issueList for the board) Or transitions the issue(s) to the first column for a kanban board with backlog.
- Request POST
- Parameters
board_id – required
- Body param
rankBeforeIssue, rankAfterIssue, datatype -> string : rankCustomFieldId, datatype -> integer : issues, datatype -> Array<string>
- Returns
A string of the url
- Return type
str
- classmethod myself()¶
Return data on your own user.
- Returns
A string of the url
- Return type
str
- classmethod projects(id_or_key, query=None, uri=None, enable_undo=None)¶
Create, delete, update, archive, get status.
- request POST
for project creations.
The project types are available according to the installed Jira features as follows
- param id_or_key
required
- param uri
optional for accessing other project endpoints -> string
endpoint: /rest/api/3/project/{projectIdOrKey}/{archive} available options [archive, delete, restore, statuses]
archive - Archives a project. Archived projects cannot be deleted.
delete - Deletes a project asynchronously.
restore - Restores a project from the Jira recycle bin.
statuses - Returns the valid statuses for a project.
- body param
projectTypeKey and projectTemplateKey required, datatype -> string : name, key, description, leadAccountId, url, assigneeType, datatype -> string : avatarId, issueSecurityScheme, permissionScheme, notificationScheme, categoryId,
datatype -> integer
- request GET
Returns the project details for a project.
This operation can be accessed anonymously.
- query param
expand, datatype -> string
properties, datatype -> Array<string>
- request PUT
Updates the project details for a project.
- param query
expand, datatype -> string
- body param
projectTypeKey and projectTemplateKey required, datatype -> string : name, key, description, leadAccountId, url, assigneeType, datatype -> string : avatarId, issueSecurityScheme, permissionScheme, notificationScheme, categoryId,
datatype -> integer
- request DELETE
Deletes a project.
- param enable_undo
datatype -> boolean
- return
A string of the url
- Parameters
query (Optional[str]) –
uri (Optional[str]) –
enable_undo (Optional[bool]) –
- Return type
str
- classmethod remote_links(key_or_id=None, link_id=None)¶
Returns the remote issue links for an issue. When a remote issue link global ID is provided the record with that global ID is returned.
When using PUT and POST method, the body parameter are similar and the object body parameter is required.
When using the DELETE method, you can delete remote issue link by globalId or you can delete by id
- Request GET
Gets the remote link
- Parameters
key_or_id (Optional[str]) –
The ID or key of the issue. :body param: globalId - datatype(str)
The global ID of the remote issue link.
link_id (Optional[str]) – The ID of the remote issue link.
- Request POST
Create or update remote link.
- Body param
- globalId - datatype(str)
The global ID of the remote issue link.
application - datatype(dict) Details of the remote application the linked item is in. For example, trello. relationship - datatype(str) Description of the relationship between the issue and the linked item. object - datatype(dict) Details of the item linked to.
- Request DELETE
Deletes the remote issue link from the issue using the link’s global ID.
- Request PUT
Updates a remote issue link for an issue.
- Returns
A string construct of the url
- Return type
str
- classmethod remove_customers(service_desk_id)¶
This method removes one or more customers from a service desk.
The service desk must have closed access. If any of the passed customers are not associated with the service desk, no changes will be made for those customers and the resource returns a 204 success code.
- Request DELETE
- Parameters
service_desk_id – required
- Body param
usernames, accountIds, datatype -> Array<string>
- Returns
A string of the url
- Return type
str
- classmethod remove_sd_organization(service_desk_id)¶
This method removes an organization from a service desk.
If the organization ID does not match an organization associated with the service desk, no change is made and the resource returns a 204 success code.
- Request DELETE
- Parameters
service_desk_id – required
- Body param
organizationId, datatype -> integer
- Returns
A string of the url
- Return type
str
- classmethod remove_users_from_organization(org_id)¶
This method removes users from an organization.
- Request DELETE
- Parameters
org_id – required
- Body param
usernames, accountIds, datatypes -> Array<string>
- Returns
A string of the url
- Return type
str
- classmethod search_all_notification_schemes(query=None, start_at=0, max_results=50)¶
Returns a paginated list of notification schemes ordered by display name.
- Parameters
query (Optional[str]) – 1st String value for expand= {all, field, group, user, projectRole, notificationSchemeEvents}
start_at – has default value of 0
max_results – has default value of 50
- Returns
A string of the url
- Return type
str
- classmethod search_all_screens(query=0)¶
Returns a paginated list of all screens or those specified by one or more screen IDs.
- Parameters
query (int) –
has default value of 0
maxResults=100 (default)
- Returns
A string of the url
- Return type
str
- classmethod search_all_workflow_schemes(query=0)¶
Returns a paginated list of all workflow schemes, not including draft workflow schemes.
- Parameters
query (int) –
has default value of 0
filled - maxResults=50 (default)
- Returns
A string of the url
- Return type
str
- classmethod search_all_workflows(query=0)¶
Returns a paginated list of published classic workflows. When workflow names are specified.
details of those workflows are returned. Otherwise, all published classic workflows are returned. This operation does not return next-gen workflows.
- Parameters
query (int) –
has default value of 0
filled - maxResults=50 (default)
- Returns
A string of the url
- Return type
str
- classmethod search_for_dashboard(query=None, start_at=0)¶
Returns a paginated list of dashboards. This operation is similar to
Get dashboards except that the results can be refined to include dashboards that have specific attributes. For example, dashboards with a particular name. When multiple attributes are specified only filters matching all attributes are returned.
- Parameters
query (Optional[str]) – 1st String value dashboardName, accountId, owner, groupname, projectId
start_at (int) – has default value of 0
- Param
filled: - maxResult=20 (default)
- Returns
A string of the url
- Return type
str
- classmethod search_for_filters(query=None, start_at=0)¶
Returns a paginated list of filters. Use this operation to get:
specific filters, by defining id only.
filters that match all of the specified attributes. For example, all filters
for a user with a particular word in their name. When multiple attributes are specified only filters matching all attributes are returned.
- Parameters
query (Optional[str]) – 1st String value filterName, accountId, owner, groupname, projectId
start_at (int) – has default value of 0
- Param
filled: - maxResults=50 (default)
- Returns
A string of the url
- Return type
str
- classmethod search_for_screen_schemes(query=0)¶
Returns a paginated list of screen schemes.
Only screen schemes used in classic projects are returned.
- Parameters
query (int) –
has default value of 0
maxResults=25 (default)
- Returns
A string of the url
- Return type
str
- classmethod search_issues_jql(query, start_at=0, max_results=50)¶
Searches for issues using JQL.
- Parameters
query – A search term.
start_at (int) – A record start row
max_results (int) – A max result to return
- Returns
A string of the url
- Return type
str
- classmethod search_users(query=0, max_result=50)¶
Search multiple users and retrieve the data
- Parameters
query (int) – An integer record row
max_result (int) – An integer of max capacity
- Returns
A string of the url
- Return type
str
- classmethod task(task_id=None, method='GET')¶
When a task has finished, this operation returns the JSON blob applicable to the task
- Request GET
Returns the status of a long-running asynchronous task.
- Request POST
Cancels a task.
- Parameters
task_id (Optional[str]) – The ID of the task.
method (Optional[str]) – A HTTP request type
- Returns
str
- Return type
str
- classmethod update_sprint(sprint_id)¶
Performs a full update of a sprint.
A full update means that the result will be exactly the same as the request body. Any fields not present in the request JSON will be set to null.
- Request PUT
- Parameters
sprint_id – required
- Body param
name, state, startDate, endDate, goal, self (format: uri), completeDate, datatype -> string : id, originBoardId, datatype -> integer
- Returns
A string of the url
- Return type
str
- classmethod webhooks(uri=None)¶
Makes a call to the webhook API. Only connect app or OAuth 2.0 can use this connection.
- Request GET
Returns a paginated list of the webhooks registered by the calling app.
- Request POST
Registers webhooks.
- Request DELETE
Removes webhooks by ID. :body param: webhookIds - required List[int]
- Parameters
uri (Optional[str]) –
A url path context options available
failed
- Returns webhooks that have recentlyfailed
refresh
- Extends the life of webhook.
- Request GET
After 72 hours the failure may no longer be returned by this operation.
- Request PUT
Webhooks registered through the REST API expire after 30 days
- Returns
str
- Return type
str
- classmethod work_logs(key_or_id=None, start_at=0, max_results=1048576, started_after=None, started_before=None, worklog_id=None, expand=None, notify_users=True, adjust_estimate='auto', new_estimate=None, increase_by=None, override_editable_flag=False, reduce_by=None, since=None)¶
Returns worklogs for an issue, starting from the oldest worklog or from the worklog started on or after a date and time.
- Request GET
Returns worklogs for an issue
- Request GET
Returns a worklog. When a worklog_id is specified
- Parameters
key_or_id (Optional[str]) – The ID or key of the issue.
start_at (int) – The index of the first item to return in a page of results (page offset).
max_results (int) – The maximum number of items to return per page.
started_after (Optional[int]) – The worklog start date and time, as a UNIX timestamp in milliseconds, after which worklogs are returned.
started_before (Optional[int]) – The worklog start date and time, as a UNIX timestamp in milliseconds, before which worklogs are returned.
worklog_id (Optional[str]) – The ID of the worklog.
expand (Optional[str]) – Use expand to include additional information about worklogs in the response.
notify_users (Optional[bool]) – Whether users watching the issue are notified by email.
adjust_estimate (Optional[str]) –
- Defines how to update the issue’s
time estimate, the options are
new
Sets the estimate to a specific value,defined in newEstimate.
leave
Leaves the estimate unchanged.auto
Updates the estimate by the differencebetween the original and updated value of
timeSpent or timeSpentSeconds.
Valid values: new, leave, manual, auto
new_estimate (Optional[str]) – The value to set as the issue’s remaining time estimate, as days (#d), hours (#h), or minutes (#m or #). For example, 2d. Required when adjustEstimate is new.
override_editable_flag (Optional[bool]) – Whether the worklog should be added to the issue even if the issue is not editable.
increase_by (Optional[str]) – The amount to increase the issue’s remaining estimate by, as days (#d), hours (#h), or minutes (#m or #). For example, 2d.
reduce_by (Optional[str]) – The amount to reduce the issue’s remaining estimate by, as days (#d), hours (#h), or minutes (#m). For example, 2d.
since (Optional[int]) – The date and time, as a UNIX timestamp in milliseconds, after which updated worklogs are returned.
- Request POST
Adds a worklog to an issue. Other query parameters can be specified such as
adjust_estimate
argument.- Request PUT
Updates a worklog. When a worklog_id is specified
- Request DELETE
Deletes a worklog from an issue. When a worklog_id is specified. Other query parameters can be specified such as
adjust_estimate
argument.- Returns
str
- Return type
str
- classmethod worklog_properties(key_or_id=None, worklog_id=None, property_key=None)¶
Returns the worklog properties of an issue
- Request GET
Returns the keys of all properties for a worklog.
- Parameters
key_or_id (Optional[str]) – The ID or key of the issue.
worklog_id (Optional[str]) – The ID of the worklog.
property_key (Optional[str]) – The key of the property.
- Request GET
Returns the value of a worklog property.
- Request PUT
Sets the value of a worklog property. :body param: The request body can contain any
valid application/json.
- Request DELETE
Deletes a worklog property.
- Returns
str
- Return type
str
LOGIN¶
This is a call to the Credentials
class. The way to use this class is to make a call to
LOGIN
from jiraone import LOGIN
user = "email"
password = "token"
link = "https://yourinstance.atlassian.net"
LOGIN(user=user, password=password, url=link)
Once a login session starts, you can join other classes and make a call directly to other objects.
from jiraone import LOGIN, endpoint
# previous login statement
LOGIN.get(endpoint.myself())
- class jiraone.access.Credentials(user, password, url=None, oauth=None, session=None)¶
class.Credentials -> used for authentication of the user to the Instance.
- Parameters
user (str) –
password (str) –
url (str) –
oauth (dict) –
session (Any) –
- custom_method(*args, **kwargs)¶
A custom request to HTTP request.
import jiraone # previous login expression req = jiraone.LOGIN.custom_method('GET', 'https://elfapp.website') print(req) # <Response [200]>
- Parameters
args –
The HTTP method type e.g. PUT, PATCH, DELETE etc
Also, includes the URL that needs to be queried.
kwargs –
Additional keyword arguments to
requests
moduleFor example: json={“file”: content} data={“file”: content}
- Returns
A HTTP response
- Return type
Response
- delete(url, **kwargs)¶
A delete request to HTTP request.
- Parameters
url – A valid URL
kwargs – Additional keyword arguments to
requests
module
- Returns
A HTTP response
- Return type
Response
- get(url, *args, payload=None, **kwargs)¶
A get request to HTTP request.
- Parameters
url – A valid URL
args – Additional arguments if any
payload – A JSON data representation
kwargs – Additional keyword arguments to
requests
module
- Returns
A HTTP response
- Return type
Response
- oauth_session(oauth)¶
A session initializer to HTTP request using OAuth.
This method implements the
Atlassian OAuth 2.0 3LO implementation. To reissue token, this method uses a refresh token session. This is possible, if the scope in the ``callback_url
containsoffline_access
.client = { "client_id": "JixkXXX", "client_secret": "KmnlXXXX", "name": "nexusfive", "callback_url": "https://auth.atlassian.com/XXXXX" }
A typical client object should look like the above. Which is passed to the
LOGIN
initializer as below. Thename
key is needed to specifically target an instance, but it is optional if you have multiple instances that your app is connected to. Theclient_id
,client_secret
andcallback_url
are mandatory.from jiraone import LOGIN # previous expression LOGIN(oauth=client)
To store and reuse the oauth token, you will need to call the property value. This object is a string which can be stored to a database and pulled as a variable.
import os # Example for storing the OAuth token dumps = LOGIN.save_oauth # this is a property value which contains a dict of tokens in strings # As long as a handshake has been allowed with OAuth, the above should exist. LOGIN.save_oauth = f"{json.dumps(dumps)}" # with the above string, you can easily save your OAuth tokens into a DB or file. # Please note that when you initialize the oauth method, you do not need to set # The property variable, as it will be set automatically after initialization. # But you can assign other string objects to it or make a call to it.
- Parameters
oauth (dict) – A dictionary containing the client and secret information and any other client information that can be represented within the data structure.
- Returns
None
- Return type
None
- post(url, *args, payload=None, **kwargs)¶
A post request to HTTP request.
- Parameters
url – A valid URL
args – Additional arguments if any
payload – A JSON data representation
kwargs – Additional keyword arguments to
requests
module
- Returns
A HTTP response
- Return type
Response
- put(url, *args, payload=None, **kwargs)¶
A put request to HTTP request.
- Parameters
url – A valid URL
args – Additional arguments if any
payload – A JSON data representation
kwargs – Additional keyword arguments to
requests
module
- Returns
A HTTP response
- Return type
Response
- property save_oauth: str¶
Defines the OAuth data to save.
- token_session(email=None, token=None, sess=None, _type='Bearer')¶
A session initializer to HTTP request.
New in version 0.7.1.
_type - Datatype(string) - Allows a change of the Authorization type
New in version 0.6.5.
sess - Datatype(string) - Allows the use of an Authorization header
- Parameters
email (Optional[str]) – An email address or username
token (Optional[str]) – An API token or user password
sess (Optional[str]) – Triggers an Authorization bearer session
_type (str) – An acceptable Authorization type e.g. Bearer or JWT or …
- Returns
None
- Return type
None
field¶
Alias to the Field
class and it basically helps to update custom or system fields on Jira.
You can access this class and make updates to Jira fields.
from jiraone import LOGIN, field, echo
# previous login statement
issue = "T6-75"
fields = "Multiple files" # a multiselect custom field
case_value = ["COM Row 1", "Thanos"]
for value in case_value:
c = field.update_field_data(data=value, find_field=fields, key_or_id=issue, options="add", show=False)
echo(c)
- class jiraone.access.Field¶
Field class helps with Jira fields.
It helps with posting, putting and getting various fields or field type.
It comes with two attributes
field_type
field_search_key
- static cascading(data=typing.Any)¶
Transform a string or a list into a cascading select type.
- Parameters
data (Any) – A string or list content
- Returns
A list object or none.
- Return type
Any
- static data_load(data=typing.Any, s=None)¶
Process the received data into a dict.
- Parameters
s (Optional[Any]) – Any object to change s to not None
data (Any) – any object
- Returns
A dictionary content
- Return type
Dict
- static extract_issue_field_options(key_or_id=None, search=None, amend=None, data=typing.Any)¶
Get the option from an issue.
Use this method to extract and amend changes to system fields such as Components or fix versions, labels or custom fields such a multicheckboxes or multiselect.
- Parameters
key_or_id (Optional[Union[str, int]]) – datatype[String, Integer] issue key or id of an issue.
search (Optional[Dict]) – datatype[Dict] issue data of an issue or issue payload.
amend (Optional[str]) – datatype[String] available option “add” or “remove” condition to decide action for appending.
data (Any) – datatype[string] our object data that will be processed.
- Returns
List or None
- Return type
Any
- static get_field(find_field=None)¶
Search for system fields or custom fields.
- Parameters
find_field (Optional[str]) – A field name to search.
- Returns
A dictionary if field is found else None
- Return type
Any
- get_field_value(name, keys)¶
Return the value of a field on an issue.
- Parameters
name (str) – The name of a field.
keys (Union[str, int]) – The issue key or issue id of an issue.
- Returns
Any datatype is returned
- Return type
Any
- static multi_field(data=typing.Any, s='value')¶
Transform any given string separated by comma into an acceptable multi value string.
- Parameters
data (Any) – any string object data.
s (str) –
is a placeholder to determine the object key.
e.g. required output [{“value”: “hello”}] -> for Multicheckboxes type of field.
e.g. required output [{“name”: “hello”}] -> for Components or Fix versions type of field.
- Returns
A list of data
- Return type
List
- static search_field(find_field=None)¶
Search for custom fields.
- Parameters
find_field (Optional[str]) – A field name to search.
- Returns
A dictionary if field is found else None
- Return type
Any
- update_field_data(data=None, find_field=None, field_type='custom', key_or_id=None, show=True, **kwargs)¶
Field works for.
All field types mentioned on the Field class attributes.
- Request PUT
- Parameters
data (Optional[Any]) – datatype[Any] the data you’re trying to process, depending on what field it could be any object.
find_field (Optional[str]) – datatype[String] name of the custom field or system field to find in strings.
field_type (str) – datatype[String] available options - system or custom.
key_or_id (Optional[Union[str, int]]) – datatype[String or Integer] issue key or id of an issue.
show (bool) – datatype[Bool] allows you to print out a formatted field that was searched.
kwargs –
datatype[String] perform other operations with keyword args
options arg is a string and has two values “add” or “remove”.
- query arg is a string and it can have any value that is stated on the endpoint.issue() method
e.g. query=”notifyUsers=false”
- Returns
Any
- Return type
Any
For¶
The
For
class shows an implementation of afor
loop. It comes with a special method that helps with dictionary indexing.
- class jiraone.access.For(data, limit=0)¶
A Class to show the implementation of a ‘for’ loop.
It calls the __iter__ magic method then the __next__ method and raises a StopIteration once it reaches the end of the loop. Datatype expected are list, dict, tuple, str, set or int.
- Parameters
data (Union[list, tuple, dict, set, str, int]) –
limit (int) –
manage¶
The manage
class is a alias to UserManagement
class of the management
module. It focuses primarily on
user and organization management. The authentication is different as it uses a bearer token.
from jiraone import manage
token = "Edfj78jiXXX"
manage.add_token(token)
- class jiraone.management.UserManagement¶
The UserManagement API is used to access organization profiles on Atlassian sites. The alias to this class is called
manage
It comes with the below attributes and methods.
token = "YUISNxxx" manage.api_token(token) manage.LINK # attribute manage.AUTH # attribute
- add_token(token)¶
Adds a Bearer token to authenticate the API.
- Parameters
token (str) – An API key
- Returns
None
- Return type
None
- api_token(account_id, method='GET', token_id=None)¶
Gets the API tokens owned by the specified user or Deletes a specified API token by ID.
- Parameters
account_id (str) – A user string value for Atlassian accounts
method (str) – A response method condition
token_id (Optional[str]) – A user token id to be deleted.
- Returns
Any
- Return type
Any
- property domain_id¶
Get property of organization domain id
- property event_id¶
Get property of organization event id
- static find_user(query, source=None)¶
Finds a specific user.
- Parameters
query (str) – A search term, could be an email, displayname or accountId if
source (Optional[List]) –
- Return type
Union[Dict, List]
the
source
data is gotten fromself.get_all_users
and parameterdetail=True
- Parameters
source (Optional[List]) – A list of users
query (str) –
- Returns
A dict of the user data or a list of the data
- Return type
Union[Dict, List]
- get_all_users(source, detail=False)¶
Store all user list from organization, so we can search them by email.
from jiraone import manage as org token = "VGHxxxxx" org.add_token(token) get_users = org.get_organization(org.org_id, filter_by="users").json() all_users = org.get_all_users(get_users) # output is a deque list, which can be accessed like a regular list. print(all_users)
- Parameters
source – A JSON response payload
detail (bool) – Bool defaults to False
- Returns
Deque List
- Return type
deque
- get_organization(org_id=None, filter_by=None, domain_id=None, event_id=None, action=True, policy_id=None, **kwargs)¶
GET request for the organization API.
Returns a list of your organizations (based on your API key).
Returns information about a single organization by ID.
Returns a list of users in an organization.
Returns a list of domains in an organization one page at a time.
Returns information about a single verified domain by ID.
Returns information about a single event by ID.
Returns information about org policies
Returns information about a single policy by ID
- Parameters
org_id (Optional[str]) – Retrieve the organization id from the API key
domain_id (Optional[str]) – Retrieve domain details
filter_by (Optional[str]) –
Use to determine the endpoint to return
Valid options
users - return the users in an organization
domains - list of domains in an organization
events - list of events in an audit log
policies - get the policy of the organization
event_id (Optional[str]) – Use to determine the events in the audit log
action (Optional[bool]) –
Additional positional argument for events. True sets events-actions
- action - Sets the event actions, true to enable by default set to true.
e.g action=True
policy_id (Optional[str]) – An id of the policy
kwargs (Any) –
Optional arguments
Valid options
Any response argument
- e.g json=payload
data=payload
- Returns
Any
- Return type
Any
- get_user_permission(account_id, query=None)¶
Returns the set of permissions you have for managing the specified Atlassian account.
- Parameters
account_id (str) – A user string value for Atlassian accounts
query (Optional[list]) –
A query parameter of Array<string>
Valid options
Valid values: profile, profile.write, profile.read, email.set, lifecycle.enablement, apiToken.read, apiToken.delete
- Returns
Any
- Return type
Any
- manage_organization(org_id, method='POST', policy_id=None, resource_id=None, **kwargs)¶
Create, put and delete organization data
Create a policy for an org Send a post request by using method=”post” as keyword args
Update a policy for an org. Send a put request by using method=”put” as keyword args
You will need to send a payload for the body using the example shown below
{ "id": "<string>", "type": "policy", "attributes": { "type": "ip-allowlist", "name": "<string>", "status": "enabled", "rule": {}, "resources": [ { "id": "<string>", "meta": { "scheduledDate": "<string>", "migrationStartDateTime": "<string>", "migrationEndDataTime": "<string>", "atlassianAccountId": "<string>" }, "links": { "ticket": "<string>" } } ] } }
Delete a policy for an org
- Parameters
org_id (str) – ID of the organization to create policy for
method (str) –
A response method to set
Valid options
PUT - updates resource
POST - creates resource
DELETE - removes resources
policy_id (Optional[str]) – ID of the policy
resource_id (Optional[str]) – Resource ID
kwargs (Any) – Additional data to sent in request body
- Returns
Any
- Return type
Any
- manage_profile(account_id, method='GET', **kwargs)¶
Returns information about a single Atlassian account by ID by using a “GET” request.
- Request PATCH
Updates fields in a user account.
- Parameters
account_id (str) –
method (str) –
kwargs (Any) –
- Return type
Any
The profile.write privilege details which fields you can change.
- Request PUT
Sets the specified user’s email address.
- Parameters
account_id (str) –
method (str) –
kwargs (Any) –
- Return type
Any
Before using this endpoint, you must verify the target domain
- Parameters
account_id (str) – A user string value for Atlassian accounts
method (str) –
A response method condition
Available options
- request GET
Get the return request
- request PATCH
Updates a given set of data
- body parameter
Any or all user object this is value
e.g. {“name”: “Lila User”, “nickname”: “marshmallow”}
- request PUT
Change the email account of the user
kwargs (Any) –
Contains other options passed to the requests.<patch>
- Body parameter
email - string e.g. {“email”: “prince.nyeche@elfapp.website”}
- Return type
Any
# previous expression # json=<variable_name> payload = {"email": "prince.nyeche@elfapp.website"} manage.manage_profile("account_id", "<method>", json=payload)
- Returns
Any
- Parameters
account_id (str) –
method (str) –
kwargs (Any) –
- Return type
Any
- manage_user(account_id, disable=True, **kwargs)¶
Disables the specified user account. The permission to make use of this resource is exposed by the lifecycle.enablement privilege.
OR
Enables the specified user account.
The permission to make use of this resource is exposed by the lifecycle.enablement privilege.
- Parameters
account_id (str) – A user string value for Atlassian accounts
disable (bool) – A bool option, if True this API url is set to disabled
kwargs –
Additional keyword argument to pass body data
Options available when disable is False
- Return type
Any
# previous expression payload = {"message": "On 6-month suspension"} manage.manage_user("account_id", json=payload)
- Returns
Any
- Parameters
account_id (str) –
disable (bool) –
- Return type
Any
- property org_id¶
Get property of organization id
- property org_ids¶
Get property of organization ids
- property policy_id¶
Get property of organization policy id
PROJECT¶
This is an alias to the Projects
class of the reporting
module. It performs various project reporting task and data extraction.
from jiraone import LOGIN, PROJECT
# previous login statement
jql = "project = ABC ORDER BY Rank DESC"
PROJECT.change_log(jql)
- class jiraone.reporting.Projects¶
Get report on a Project based on user or user’s attributes or groups.
- static byte_converter(val)¶
1 Byte = 8 Bits.
using megabyte MB, value is 1000^2
mebibyte MiB, value is 1024^2
Therefore total = val / MB
- Parameters
val – A value to supply
- Returns
strings
- Return type
str
- static bytes_converter(val)¶
Returns unit in KB or MB.
1 Byte = 8 Bits.
using megabyte MB, value is 1000^2
mebibyte MiB, value is 1024^2
Therefore total = val / MB
- Parameters
val – An integer value
- Returns
string
- Return type
str
- static change_log(folder='ChangeLog', file='change_log.csv', back_up=False, allow_cp=True, **kwargs)¶
Extract the issue history of an issue.
Query the changelog endpoint if using cloud instance or straight away define access to it on server. Extract the histories and export it to a CSV file.
- Parameters
folder (str) – A name of a folder datatype String
file (str) – A name of a file datatype String
back_up (bool) – A boolean to check whether a history file is exist or not.
allow_cp (bool) – Allow or deny the ability to have a checkpoint.
kwargs (Union[str, bool]) –
The other kwargs that can be passed as below.
jql: (required) A valid JQL query for projects or issues. datatype -> string
saved_file: The name of the file which saves the iteration. datatype -> string
show_output: Show a printable output on terminal. datatype -> boolean
field_name: Target a field name to render. datatype -> string
- Returns
None
- Return type
None
- comment_on(key_or_id=None, comment_id=None, method='GET', **kwargs)¶
Comment on a ticket or write on a description field.
- Request GET
comments
- Request POST
comments by id
- Request PUT
update a comment
- Request POST
add a comment
- Request DELETE
delete a comment
- Parameters
key_or_id (Optional[str]) –
comment_id (Optional[int]) –
method (str) –
- Return type
Any
Do the same thing you do via the UI.
- Returns
Any
- Parameters
key_or_id (Optional[str]) –
comment_id (Optional[int]) –
method (str) –
- Return type
Any
Retrieve the Dashboard Id/Name/owner and who it is shared with.
The only requirement is that the user querying this API should have access to all the Dashboard available else it will only return dashboard where the user’s view access is allowed.
- Parameters
dashboard_folder (str) – A folder
dashboard_file_name (str) – A file to store temp data
kwargs – Additional arguments
- Returns
None
- Return type
None
- static date_converter(val)¶
split the datetime value and output a string.
- Parameters
val – A value to be supplied
- Returns
string
- Return type
str
- static download_attachments(file_folder=None, file_name=None, download_path='Downloads', attach=8, file=6, **kwargs)¶
Download the attachments to your local device read from a csv file.
we assume you’re getting this from
def get_attachments_on_project()
method.- Parameters
attach (int) – integers to specify the index of the columns
file_folder (Optional[str]) – a folder or directory where the file
download_path (str) – a directory where files are stored
file (int) – a row to the index of the column
file_name (Optional[str]) –
a file name to a file
- e.g
attach=6,
file=8
- Return type
None
the above example corresponds with the index if using the
def get_attachments_on_project()
otherwise, specify your value in each keyword args when calling the method.- Returns
None
- Parameters
file_folder (Optional[str]) –
file_name (Optional[str]) –
download_path (str) –
attach (int) –
file (int) –
- Return type
None
- static export_issues(*, folder='EXPORT', jql=None, page=None, **kwargs)¶
Exports all Jira issue based on JQL search. If the number of issues returned is greater than 1K issues, all the issues are finally combined into a single file as output.
- Parameters
folder (Optional[str]) – The name of a folder
jql (Optional[str]) – A valid JQL
page (Optional[tuple]) – An iterative counter for page index
kwargs (Union[str, dict]) –
Additional arguments that can be supplied.
Available options
temp_file: Datatype (str) A temporary file name
when combining the exported file.
final_file: Datatype (str) Name of the final
combined CSV file name.
target: Datatype (str or dict) Ability to change or get
certain values from another instance. If and only if it is the same user who exist on both. As the same authentication needs to be used to extract or create the data else use a dict to construct a login acceptable form that can be used as authentication. This needs to be set for the
fields
argument to work properly.When used as a string, just supply the instance baseURL as string only.
# previous expression base = "https://yourinstance.atlassian.net"
Example of dict construct which can be stored as a
.json
file.{ "user": "prince@example.com", "password": "secretpassword", "url": "https://server.example.com" }
fields: Datatype (list) Ability to alter the row value
of a field. Useful when you want to change the value used for imports into Jira. Such as sprint name to id or username to accountId (Server or DC to cloud migration). This argument requires the
target
argument to be set first before it can become useful.
- Returns
None
- Return type
None
- static get_all_roles_for_projects(roles_folder='Roles', roles_file_name='roles_file.csv', user_extraction='role_users.csv', **kwargs)¶
Get the roles available in a project and which user is assigned to which role within the project.
- Parameters
roles_folder (str) – A folder
roles_file_name (str) – A file to store temp data
user_extraction (str) – Data extraction file holder
kwargs – Addition argument
- Returns
None
- Return type
None
- get_attachments_on_projects(attachment_folder='Attachment', attachment_file_name='attachment_file.csv', **kwargs)¶
Return all attachments of a Project or Projects
Get the size of attachments on an Issue, count those attachments collectively and return the total number on all Projects searched. JQL is used as a means to search for the project.
- Parameters
attachment_folder (str) – A temp folder
attachment_file_name (str) – A filename for the attachment
kwargs – Addition argument to supply.
- Returns
None
- Return type
None
- static get_total_comments_on_issues(folder='Comment', file_name='comment_file.csv', **kwargs)¶
Return a report with the number of comments sent to or by a reporter (if any).
This api will return comment count, the total comment sent by a reporter per issue and collectively sum up a total. It also shows how many comments other users sent on the issue.
- Parameters
folder (str) – The name of a folder
file_name (str) – The name of a file
kwargs – additional argument to supply
- Returns
None
- Return type
None
- static grade_and_sort(attach_list, read_file)¶
Arranges and sorts the data.
- Parameters
attach_list – A list of data
read_file – A data set
- Returns
A union of float and integers
- Return type
Union[float, int]
- static issue_count(jql)¶
Returns the total count of issues within a JQL search phrase.
- Parameters
jql – A valid JQL query
- Return type
dict
- Returns
a dictionary, containing issue count & max_page
- Parameters
jql (str) –
- Return type
dict
- static move_attachments_across_instances(attach_folder='Attachment', attach_file='attachment_file.csv', key=3, attach=8, file=6, last_cell=True, **kwargs)¶
Ability to post an attachment into another Instance.
- given the data is extracted from a csv file which contains the below information
Issue key
file name
attachment url
we assume you’re getting this from
def get_attachments_on_project()
- Parameters
attach_folder (str) – a folder or directory path
attach_file (str) – a file to a file name
key (int) – a row index of the column
attach (int) – a row index of the column
file (int) – integers to specify the index of the columns
last_cell (bool) –
is a boolean determines if the last cell should be counted. e.g
key=3,
attach=6,
file=8
- Return type
None
- the above example corresponds with the index if using the
def get_attachments_on_project()
otherwise, specify your value in each keyword args when calling the method.- return
None
- static projects_accessible_by_users(*args, project_folder='Project', project_file_name='project_file.csv', user_extraction_file='project_extract.csv', permission='BROWSE', **kwargs)¶
Send an argument as String equal to a value, example: status=live.
Multiple arguments separate by comma as the first argument in the function, all other arguments should be keyword args that follows. This API helps to generate full user accessibility to Projects on Jira. It checks the users access and commits the finding to a report file.
You can tweak the permission argument with the options mention here
for endpoint /rest/api/3/user/permission/search
- Parameters
args (str) – A set of parameter arguments to supply
project_folder (str) – A folder
project_file_name (str) – A file to hold temp data
user_extraction_file (str) – A file to hold user temp data
permission (str) – A permission of Jira to check
kwargs – Additional arguments
- Return type
None
- Returns
None
- Parameters
args (str) –
project_folder (str) –
project_file_name (str) –
user_extraction_file (str) –
permission (str) –
- Return type
None
USER¶
This is an alias to the
Users
class of thereporting
module. It contains methods that are used to easily get user details.
from jiraone import LOGIN, USER
# previous login statement
USER.get_all_users(file="user.csv", folder="USERS")
- class jiraone.reporting.Users¶
This class helps to Generate the No of Users on Jira Cloud
You can customize it to determine which user you’re looking for.
It’s method such as
get_all_users
displays active or inactive users, so you’ll be getting all users
- get_all_users(pull='both', user_type='atlassian', file=None, folder=typing.Any, **kwargs)¶
Generates a list of users.
- param pull
(options) for the argument
both: pulls out inactive and active users
active: pulls out only active users
inactive: pulls out inactive users
- Parameters
user_type (str) –
(options) for the argument
atlassian: a normal Jira Cloud user
customer: this will be your JSM customers
app: this will be the bot users for any Cloud App
unknown: as the name suggest unknown user type probably from oAuth
file (Optional[str]) – String of the filename
folder (str) – String of the folder name
kwargs –
Additional keyword argument for the method.
- return
Any
pull (str) –
- Return type
None
- get_all_users_group(group_folder='Groups', group_file_name='group_file.csv', user_extraction_file='group_extraction.csv', **kwargs)¶
Get all users and the groups associated to them on the Instance. :return: None
- Parameters
group_folder (str) –
group_file_name (str) –
user_extraction_file (str) –
- Return type
None
- mention_user(name)¶
Return a format that you can use to mention users on cloud. :param name: The name of a user.
- Returns
List[str]
- Return type
List[str]
- report(category=typing.Any, filename='users_report.csv', **kwargs)¶
Creates a user report file in CSV format. :return: None
- Parameters
category (str) –
filename (str) –
- Return type
None
- search_user(find_user=None, folder='Users', **kwargs)¶
Get a list of all cloud users and search for them by using the displayName.
- Parameters
find_user (Optional[Union[str, list]]) – A list of user’s displayName or a string of the displayName
folder (str) – A name to the folder
kwargs –
Additional arguments
options skip (bool) - allows you to skip the header of
file_reader
delimiter (str) - allows a delimiter to thefile_reader
function pull (str) - determines which user is available e.g. “active”, “inactive” user_type (str) - searches for user type e.g “atlassian”, “customer” file (str) - Name of the file
- Return type
Union[list, int]
- user_activity(status=typing.Any, account_type=typing.Any, results=typing.Any)¶
Determines users activity.
- Returns
None
- Parameters
status (str) –
account_type (str) –
results (List) –
- Return type
None
Module¶
The module
module contains functions that are specific towards certain task. Each function is designed to be as straightforward
as possible, so you can easily make calls to Jira’s endpoint and get the required data.
from jiraone import LOGIN, USER, echo, field
from jiraone.module import field_update
import json
# a configuration file which is a dict containing keys user, password and url
config = json.load(open('config.json'))
LOGIN(**config)
key = 'ITSM-4'
name = 'Last Update User' # A single user picker field
if __name__ == "__main__":
change = USER.search_user('Prince Nyeche')[0].get('accountId')
make = field_update(field, key, name, data=change)
echo(make)
# output
# <Response [204]>
- jiraone.module.field_update()¶
- jiraone.module.time_in_status(var, key_or_id, reader=None, report_file='time_status.csv', report_folder='TimeStatus', output_format=None, status=None, **kwargs)¶
Return a difference in time between two status or multiple statuses. across different sets of issues. Display the output or send the output into a file either in CSV or JSON.
- Parameters
var (Any) – Alias to the
PROJECT
which can invoke thechange_log()
methodkey_or_id (Union[str, int, List[Union[str, int]], dict]) – An issue key or id or keys put in a list to derive multiples values or use a jql format in dictionary
reader (Optional[Callable]) –
file_reader
function needs to be passed herereport_file (Optional[str]) – A string of the name of the file
report_folder (Optional[str]) – A folder where data resides
output_format (Optional[str]) – An output format either in CSV or JSON. e.g csv or json (case insensitive)
status (Optional[str]) – A status name to check or output.
kwargs (Any) –
Additional keyword arguments to use
Available options
login - Required keyword argument to authenticate request
pprint -Bool, Optional -formats the datetime output into a nice pretty format.
is_printable - Bool, prints output to terminal if true
# previous expression # To print out the function, you can either use ``echo`` function or ``print`` built-in status = time_in_status(PROJECT, key, file_reader, login=LOGIN, pprint=True, output_format="json", is_printable=True) echo(status)
- Returns
A Printable representation of the data or output files.
- Parameters
var (Any) –
key_or_id (Union[str, int, List[Union[str, int]], dict]) –
reader (Optional[Callable]) –
report_file (Optional[str]) –
report_folder (Optional[str]) –
output_format (Optional[str]) –
status (Optional[str]) –
kwargs (Any) –
- jiraone.module.bulk_change_email(data, token)¶
Bulk change managed user’s email address if they do not exist.
- Parameters
data (str) – A string of the file name
token (str) – A string of the API token to authenticate the request
- Return type
None
Additionally, the output of failed attempts it written back to your data file.
- Returns
None
- Parameters
data (str) –
token (str) –
- Return type
None
- jiraone.module.bulk_change_swap_email(data, token, **kwargs)¶
The function helps to swap an email address to another.
If the target email exist as an Atlassian account email, this will help to swap that email address to the desired target email.
- Parameters
data (str) – A string of the file name
token (str) – An API token to authenticate the API.
kwargs (Any) –
Additional keyword argument to pass
Valid values
- dummy - A dummy email address to choose if not a default is formed
from your email address
- users - The name of a file to check the users and their account_id
only needed if you want to search a predefined set of users.
- Returns
None
- Return type
None
Utils¶
- class jiraone.utils.DotNotation(*args, **kwargs)¶
This DotNotation
class provides the ability of using a dot notation on any dict object. Making it easier when working with dictionary objects.
Examples below
from jiraone.utils import DotNotation
# for dict operation
my_dict = {"name": "John", "unit": 7}
notation = DotNotation(my_dict)
print(notation.name)
# result
# >>> John
# for list[dict] operations
my_dict = [{"name": "John", "unit": 7}, {"name": "Jane", "unit" 8}]
notation = DotNotation(value=my_dict)
print(notation.value[0].name)
# result - access the list using index
# >>> John
Note
When loading a list of dictionary, please refer to the second example as shown on the above code. The dictionary needs to be assigned to a key (any naming convention will do) to get the value. Failure will result in an error.