Jira DC: Updating Board Saved Filters via REST API
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
If you need to perform a bulk update of your board’s filters (for example, to restore your saved filters from a backup), you can use the process below.
Solution
Collect Data from Database Snapshot
Use the below query to get the necessary data from a database snapshot:
SELECT
rv."ID" AS board_id,
rv."NAME" AS board_name,
sr.id AS filter_id,
sr.filtername AS filter_name,
sr.authorname AS filter_owner,
sr.reqcontent AS filter_jql
FROM "AO_60DB71_RAPIDVIEW" rv
LEFT JOIN searchrequest sr ON rv."SAVED_FILTER_ID" = sr.id
ORDER BY rv."ID";
Once you have this data, export it as an Excel spreadsheet or CSV, and then use PowerShell to iterate over each row and restore the SAVED_FILTER_ID.
REST API to update SAVED_FILTER_ID
curl -u <username>:<api_token> \
-X PUT \
-H "Content-Type: application/json" \
"http://host.com/rest/greenhopper/1.0/rapidviewconfig/filter" \
-d '{"id": "1", "savedFilterId": "10001"}'
PowerShell Example
This is a PowerShell script that reads an Excel file, iterates over each row, and performs a REST API call to update the board's saved filter. It uses column 1 (board ID) and column 3 (savedFilterId) from the Excel file, as per your requirements.
This script requires the ImportExcel
PowerShell module (for reading Excel files) and uses Invoke-RestMethod
for the API call.
# Install the ImportExcel module if not already installed
# Install-Module -Name ImportExcel
# Variables
$excelPath = "C:\Path\To\Your\File.xlsx"
$sheetName = "Sheet1" # Change if your sheet has a different name
$apiUrl = "<http://host.com/rest/greenhopper/1.0/rapidviewconfig/filter">
$username = "<username>"
$apiToken = "<api_token>"
# Read Excel file
$rows = Import-Excel -Path $excelPath -WorksheetName $sheetName
foreach ($row in $rows) {
$id = $row.PSObject.Properties[0].Value # Column 1: Board ID
$savedFilterId = $row.PSObject.Properties[2].Value # Column 3: SavedFilterId
$body = @{
id = "$id"
savedFilterId = "$savedFilterId"
} | ConvertTo-Json
$pair = "$username:$apiToken"
$encodedCredentials = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))
$headers = @{
Authorization = "Basic $encodedCredentials"
"Content-Type" = "application/json"
}
Write-Host "Updating board $id with filter $savedFilterId..."
try {
$response = Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method Put -Body $body
Write-Host "Success for board $id"
} catch {
Write-Host "Failed for board $id: $_"
}
}
Instructions:
Replace the variables at the top (
$excelPath
,$sheetName
,$username
,$apiToken
,$apiUrl
) with your actual values.Make sure the Excel file's first row contains headers, and the relevant data is in columns 1 and 3.
Run the script in PowerShell. If you don't have the
ImportExcel
module, install it withInstall-Module -Name ImportExcel
.
Warning: Always Back Up Your Data
Before making any bulk changes to your Jira instance—whether through direct database updates, REST API calls, or scripts—it is critical to create a full backup of your database and application data. Mistakes in bulk operations can lead to data corruption or loss and, in some cases, render your Jira instance unusable.
Test all changes in a non-production environment first, and ensure you have a reliable backup and a rollback plan before proceeding.
Was this helpful?