Jira Align
Experimental This functionality needs testing, any issues you have, create a ticket on our portal
The align
class is designed as a versatile connector for interacting with the Jira Align API, facilitating operations such as creating, reading, updating, and deleting various Jira Align objects like Themes, Epics, Features, and more. Upon instantiation, it allows for setting the site URL and authentication token, essential for API access.
The class provides methods for executing HTTP requests including GET, POST, PUT, PATCH, and DELETE, with appropriate data formatting and header handling. Additionally, it offers functionalities such as fetching all users with pagination, adding new users, enabling or disabling user accounts, among others.
Overall, the class serves as a comprehensive interface for seamless integration and interaction with the Jira Align API, offering flexibility and ease of use in managing Jira Align data and resources programmatically.
Â
Adding a New User: Suppose a new employee joins your company. You can use the
post
method to add their user details to Jira Align.
# Instantiate the align with your site URL and token
connector = align(site_url="https://your-company.jiraalign.com", token="your_api_token")
# Define data for adding a new user
new_user_data = {
"userName": "new_user",
"firstName": "New",
"lastName": "User",
"emailAddress": "newuser@example.com",
"externalId": "NU123", # Unique identifier for the user
"isLocked": False,
"isDeleted": False
}
# Make a POST request to add the new user to Jira Align
add_user_response = connector.post("/Users", data=new_user_data)
Enabling/Disabling User Accounts: As users join or leave the company, you may need to enable or disable their accounts in Jira Align. You can use the
patch
method to update the user status.
# Specify the user ID to enable and enable the user
user_id_to_enable = "user_id_to_enable" # Replace with the actual user ID
enable_user_response = connector.patch(f"/Users/{user_id_to_enable}", data=[
{"op": "replace", "path": "/isLocked", "value": 0},
{"op": "replace", "path": "/userEndDate", "value": None},
])
# Specify the user ID to disable and disable the user
user_id_to_disable = "user_id_to_disable" # Replace with the actual user ID
disable_user_response = connector.patch(f"/Users/{user_id_to_disable}", data=[
{"op": "replace", "path": "/isLocked", "value": -1},
])
Fetching User Data: You might need to retrieve user data from Jira Align for reporting or analysis purposes. You can use the
get
method to fetch all users.
# Make a GET request to fetch all users from Jira Align
all_users_response = connector.get("/Users")
Removing User Accounts: When employees leave the company, you can use the
delete
method to remove their accounts from Jira Align.
# Make a DELETE request to delete a specific user from Jira Align
user_id_to_delete = "user_id_to_delete" # Replace with the actual user ID
delete_user_response = connector.delete(f"/Users/{user_id_to_delete}")
By integrating Jira Align with your company's systems using these methods, you can effectively manage user accounts, ensuring smooth operations and data consistency across platforms.
Â
Easy for Jira - Python Automations, 2023