Update Filter Owners in Bulk Using Jira Cloud REST API
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
This article provides a step-by-step guide on updating filter owners in bulk in Jira Cloud using the REST API.
Jira Cloud has no built-in bulk filter-owner update (feature request JRACLOUD-47656). This article uses the REST API in two steps: retrieve filters, then update each owner.
Solution
Always test your script in a non-production environment first. Handle pagination (iterate over all pages so no filters are missed) and add error handling for API/network errors. A wrong accountId reassigns the filter to the wrong owner.
To update filter owners in bulk, you can use the Jira REST API. Below are the steps required to accomplish this task:
Step 1: Retrieve Filters
First, gather the list of filters you wish to update. Use the Filter Search API with the overrideSharePermissions flag set to true. This API call is paginated, so you'll need to handle pagination to retrieve all filters.
Example API Call to Retrieve Filters
GET /rest/api/3/filter/search?overrideSharePermissions=true&startAt=0&maxResults=50
Authorization: Bearer <your_access_token>
Content-Type: application/jsonReplace
<your_access_token>with your actual access token.Adjust
startAtandmaxResultsas needed to handle pagination.
Step 2: Update Filter Owner
Once you have the list of filters, update each filter's owner using the Filter Owner API.
Example API Call to Update Filter Owner
PUT /rest/api/3/filter/{filterId}/owner
Authorization: Bearer <your_access_token>
Content-Type: application/json
data: {
"accountId": "<new_owner_account_id>"
}Replace
{filterId}with the ID of the filter you want to update.Replace
<your_access_token>with your actual access token.
Replace <new_owner_account_id> with the account ID of the new owner.
After the PUT calls, re-run the Filter Search (or open a sample filter) and confirm that the owner.accountId now matches the intended new owner.
Step | Endpoint |
|---|---|
1. Retrieve filters (paginated, overrideSharePermissions=true) | GET /rest/api/3/filter/search |
2. Update each filter's owner | PUT /rest/api/3/filter/{filterId}/owner |
Important Notes
Pagination: When retrieving filters, ensure your script iterates over all pages. This ensures you capture every filter that needs updating.
Error Handling: Integrate error handling into your script to handle potential API errors, such as network issues or incorrect API request formats.
Testing: Always test your script in a safe, non-production environment to verify its functionality and ensure it performs as expected before deploying it in a live environment.
Additional Resources
This process provides a workaround for filter owners' lack of built-in bulk update functionality. It leverages Jira's REST API to automate this task efficiently.
Was this helpful?