Python Atlassian REST API Wrapper providing comprehensive access to Jira, Confluence, Bitbucket, and other Atlassian products
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Comprehensive asset and configuration management through Insight CMDB, Portfolio planning, and cloud-based asset tracking. Provides complete visibility into IT infrastructure, business assets, and project portfolio management across Atlassian environments.
Insight (Assets) REST API client for comprehensive Configuration Management Database operations including asset discovery, relationship mapping, and configuration tracking.
class Insight(AtlassianRestAPI):
def __init__(self, url: str, username: str = None, password: str = None,
token: str = None, **kwargs):
"""
Initialize Insight client.
Parameters:
- url (str): Base URL of Jira instance with Insight
- username (str, optional): Username for authentication
- password (str, optional): Password or API token
- token (str, optional): Bearer token for authentication
"""def get_object(self, object_id: str) -> T_resp_json:
"""
Get object details.
Parameters:
- object_id: Object ID
Returns:
dict: Object information with attributes and relationships
"""
def create_object(self, object_type_id: str, attributes: dict) -> T_resp_json:
"""
Create object.
Parameters:
- object_type_id: Object type ID
- attributes: Object attributes dictionary
Returns:
dict: Created object data
"""
def update_object(self, object_id: str, attributes: dict) -> T_resp_json:
"""
Update object.
Parameters:
- object_id: Object ID to update
- attributes: Updated attributes
Returns:
dict: Updated object data
"""
def delete_object(self, object_id: str) -> bool:
"""
Delete object.
Parameters:
- object_id: Object ID to delete
Returns:
bool: True if deletion successful
"""
def get_objects_by_iql(self, iql: str, start: int = 0,
limit: int = 50) -> T_resp_json:
"""
Search objects using Insight Query Language.
Parameters:
- iql: IQL query string
- start: Starting index
- limit: Maximum results
Returns:
dict: Objects matching IQL query
"""def get_object_schemas(self) -> List[dict]:
"""
Get all object schemas.
Returns:
List[dict]: Available schemas
"""
def get_object_schema(self, schema_id: str) -> T_resp_json:
"""
Get schema details.
Parameters:
- schema_id: Schema ID
Returns:
dict: Schema configuration and object types
"""
def get_object_type(self, object_type_id: str) -> T_resp_json:
"""
Get object type definition.
Parameters:
- object_type_id: Object type ID
Returns:
dict: Object type with attributes and relationships
"""
def get_object_attributes(self, object_id: str) -> List[dict]:
"""
Get object attributes.
Parameters:
- object_id: Object ID
Returns:
List[dict]: Object attributes with values
"""
def update_object_attribute(self, object_id: str, attribute_id: str,
value: str) -> T_resp_json:
"""
Update object attribute.
Parameters:
- object_id: Object ID
- attribute_id: Attribute ID
- value: New attribute value
Returns:
dict: Update result
"""Assets Cloud REST API client for Atlassian Cloud asset management with workspace-based organization and enhanced cloud integration.
class AssetsCloud(AtlassianRestAPI):
def __init__(self, url: str, username: str = None, password: str = None,
token: str = None, **kwargs):
"""
Initialize Assets Cloud client.
Parameters:
- url (str): Base URL of Atlassian Cloud instance
- username (str, optional): Username for authentication
- password (str, optional): Password or API token
- token (str, optional): Bearer token for authentication
"""def get_workspaces(self) -> List[dict]:
"""
Get all workspaces.
Returns:
List[dict]: Available workspaces
"""
def get_workspace(self, workspace_id: str) -> T_resp_json:
"""
Get workspace details.
Parameters:
- workspace_id: Workspace ID
Returns:
dict: Workspace information with schemas
"""
def create_workspace(self, name: str, description: Optional[str] = None) -> T_resp_json:
"""
Create workspace.
Parameters:
- name: Workspace name
- description: Workspace description
Returns:
dict: Created workspace data
"""def get_objects(self, workspace_id: str, object_schema_id: Optional[str] = None,
object_type_id: Optional[str] = None, aql: Optional[str] = None,
start: int = 0, limit: int = 50) -> T_resp_json:
"""
Get objects from workspace.
Parameters:
- workspace_id: Workspace ID
- object_schema_id: Filter by schema
- object_type_id: Filter by object type
- aql: Assets Query Language filter
- start: Starting index
- limit: Maximum results
Returns:
dict: Objects list with pagination
"""
def create_object(self, workspace_id: str, object_type_id: str,
attributes: List[dict]) -> T_resp_json:
"""
Create object in workspace.
Parameters:
- workspace_id: Workspace ID
- object_type_id: Object type ID
- attributes: Object attributes list
Returns:
dict: Created object data
"""
def update_object(self, workspace_id: str, object_id: str,
attributes: List[dict]) -> T_resp_json:
"""
Update object.
Parameters:
- workspace_id: Workspace ID
- object_id: Object ID
- attributes: Updated attributes
Returns:
dict: Updated object data
"""
def delete_object(self, workspace_id: str, object_id: str) -> bool:
"""
Delete object.
Parameters:
- workspace_id: Workspace ID
- object_id: Object ID
Returns:
bool: True if deletion successful
"""def get_object_schemas(self, workspace_id: str) -> List[dict]:
"""
Get workspace object schemas.
Parameters:
- workspace_id: Workspace ID
Returns:
List[dict]: Object schemas in workspace
"""
def get_object_schema(self, workspace_id: str, schema_id: str) -> T_resp_json:
"""
Get object schema details.
Parameters:
- workspace_id: Workspace ID
- schema_id: Schema ID
Returns:
dict: Schema configuration
"""Portfolio REST API client for Advanced Roadmaps project portfolio management including capacity planning, resource allocation, and strategic alignment.
class Portfolio(AtlassianRestAPI):
def __init__(self, url: str, username: str = None, password: str = None,
token: str = None, **kwargs):
"""
Initialize Portfolio client.
Parameters:
- url (str): Base URL of Jira instance with Portfolio
- username (str, optional): Username for authentication
- password (str, optional): Password or API token
- token (str, optional): Bearer token for authentication
"""def get_plans(self) -> List[dict]:
"""
Get all portfolio plans.
Returns:
List[dict]: Available plans
"""
def get_plan(self, plan_id: str) -> T_resp_json:
"""
Get plan details.
Parameters:
- plan_id: Plan ID
Returns:
dict: Plan configuration with issues and timeline
"""
def create_plan(self, name: str, description: str = "",
project_keys: Optional[List[str]] = None) -> T_resp_json:
"""
Create portfolio plan.
Parameters:
- name: Plan name
- description: Plan description
- project_keys: Associated project keys
Returns:
dict: Created plan data
"""
def update_plan(self, plan_id: str, name: Optional[str] = None,
description: Optional[str] = None) -> T_resp_json:
"""
Update plan.
Parameters:
- plan_id: Plan ID
- name: New plan name
- description: New description
Returns:
dict: Updated plan data
"""
def delete_plan(self, plan_id: str) -> bool:
"""
Delete plan.
Parameters:
- plan_id: Plan ID to delete
Returns:
bool: True if deletion successful
"""def get_teams(self) -> List[dict]:
"""
Get all teams.
Returns:
List[dict]: Available teams
"""
def get_team(self, team_id: str) -> T_resp_json:
"""
Get team details.
Parameters:
- team_id: Team ID
Returns:
dict: Team information with members and capacity
"""
def create_team(self, name: str, members: Optional[List[str]] = None) -> T_resp_json:
"""
Create team.
Parameters:
- name: Team name
- members: List of member user keys
Returns:
dict: Created team data
"""
def update_team(self, team_id: str, name: Optional[str] = None,
members: Optional[List[str]] = None) -> T_resp_json:
"""
Update team.
Parameters:
- team_id: Team ID
- name: New team name
- members: Updated member list
Returns:
dict: Updated team data
"""def get_scenarios(self, plan_id: str) -> List[dict]:
"""
Get plan scenarios.
Parameters:
- plan_id: Plan ID
Returns:
List[dict]: Plan scenarios for capacity planning
"""
def create_scenario(self, plan_id: str, name: str,
description: Optional[str] = None) -> T_resp_json:
"""
Create planning scenario.
Parameters:
- plan_id: Plan ID
- name: Scenario name
- description: Scenario description
Returns:
dict: Created scenario data
"""
def get_capacity(self, plan_id: str, team_id: Optional[str] = None) -> T_resp_json:
"""
Get capacity information.
Parameters:
- plan_id: Plan ID
- team_id: Filter by team ID
Returns:
dict: Capacity data with allocations
"""from atlassian import Insight
insight = Insight(
url="https://jira.company.com",
username="username",
password="password"
)
# Get schemas
schemas = insight.get_object_schemas()
# Search for servers using IQL
servers = insight.get_objects_by_iql(
'objectType = "Server" AND Status = "Active"'
)
# Create new server object
server = insight.create_object(
object_type_id="server-type-id",
attributes={
"Name": "web-server-01",
"IP Address": "192.168.1.100",
"Operating System": "Ubuntu 20.04",
"Status": "Active"
}
)
# Update server attributes
insight.update_object_attribute(
server["id"],
"status-attribute-id",
"Maintenance"
)from atlassian import AssetsCloud
assets = AssetsCloud(
url="https://your-domain.atlassian.net",
username="email@example.com",
password="api-token"
)
# Get workspaces
workspaces = assets.get_workspaces()
# Get objects from workspace
objects = assets.get_objects(
workspace_id="workspace-123",
aql='Name LIKE "server%"'
)
# Create asset
asset = assets.create_object(
workspace_id="workspace-123",
object_type_id="server-type",
attributes=[
{
"objectTypeAttributeId": "name-attr-id",
"objectAttributeValues": [{"value": "new-server"}]
},
{
"objectTypeAttributeId": "ip-attr-id",
"objectAttributeValues": [{"value": "10.0.0.50"}]
}
]
)from atlassian import Portfolio
portfolio = Portfolio(
url="https://your-domain.atlassian.net",
username="email@example.com",
password="api-token"
)
# Create portfolio plan
plan = portfolio.create_plan(
name="Q4 2024 Roadmap",
description="Strategic initiatives for Q4",
project_keys=["PROJ1", "PROJ2", "PROJ3"]
)
# Create team
team = portfolio.create_team(
name="Backend Development Team",
members=["john.doe", "jane.smith", "bob.wilson"]
)
# Create planning scenario
scenario = portfolio.create_scenario(
plan_id=plan["id"],
name="Aggressive Timeline",
description="Scenario with compressed delivery timeline"
)
# Get capacity data
capacity = portfolio.get_capacity(
plan_id=plan["id"],
team_id=team["id"]
)
print(f"Team capacity: {capacity['totalCapacity']} hours")
print(f"Allocated: {capacity['allocatedCapacity']} hours")
print(f"Available: {capacity['remainingCapacity']} hours")# Automated asset discovery and update
def discover_and_update_assets():
# Discover servers from Insight
servers = insight.get_objects_by_iql(
'objectType = "Server" AND "Last Updated" < now("-30d")'
)
for server in servers["objectEntries"]:
# Get server details from monitoring system
server_data = get_server_monitoring_data(server["name"])
# Update asset with current information
insight.update_object(
server["id"],
{
"CPU Usage": server_data["cpu_usage"],
"Memory Usage": server_data["memory_usage"],
"Disk Usage": server_data["disk_usage"],
"Last Updated": datetime.now().isoformat()
}
)
# Create alerts in Portfolio if capacity issues
if server_data["cpu_usage"] > 80:
# Link to capacity planning in Portfolio
portfolio.create_scenario(
plan_id="infrastructure-plan",
name=f"Scale {server['name']}",
description=f"Server {server['name']} requires scaling"
)from atlassian.errors import ApiNotFoundError, ApiPermissionError
try:
object_data = insight.get_object("invalid-id")
except ApiNotFoundError:
print("Object not found")
except ApiPermissionError:
print("Access denied to object")from atlassian.typehints import T_id, T_resp_json
from typing import List, Dict, Optional
# Insight types
ObjectId = str
ObjectTypeId = str
SchemaId = str
IQLQuery = str # Insight Query Language
# Assets Cloud types
WorkspaceId = str
AQLQuery = str # Assets Query Language
# Portfolio types
PlanId = str
TeamId = str
ScenarioId = strInstall with Tessl CLI
npx tessl i tessl/pypi-atlassian-python-api