I tried using this REST API.
The API I'm using only allows prefix-based search for projects. Are there any APIs that support partial or fuzzy matching instead?
Only self-made script.
I have python script, but you can make Scriptrunner or something else
import requests
# ==== CONFIGURATION ====
JIRA_URL = "https://your-jira-server.com"
USERNAME = "your-username"
API_TOKEN = "your-api-token-or-password" # For Server/DC you can also use your password
SEARCH_TERM = "test" # <- Enter the keyword to search for
# ==== AUTHENTICATION ====
auth = (USERNAME, API_TOKEN)
headers = {"Accept": "application/json"}
# ==== FETCH ALL PROJECTS WITH PAGINATION ====
def get_all_projects():
projects = []
start_at = 0
max_results = 50 # Page size
while True:
url = f"{JIRA_URL}/rest/api/2/project/search?startAt={start_at}&maxResults={max_results}"
response = requests.get(url, headers=headers, auth=auth)
response.raise_for_status()
data = response.json()
projects.extend(data.get("values", []))
if data.get("isLast", True):
break
start_at += max_results
return projects
# ==== PERFORM FUZZY (PARTIAL) SEARCH ====
def fuzzy_search_projects(projects, query):
query_lower = query.lower()
return [
p for p in projects
if query_lower in p["key"].lower() or query_lower in p["name"].lower()
]
# ==== MAIN EXECUTION ====
if __name__ == "__main__":
all_projects = get_all_projects()
matched = fuzzy_search_projects(all_projects, SEARCH_TERM)
print(f"Found {len(matched)} project(s) matching '{SEARCH_TERM}':")
for project in matched:
print(f"- {project['key']}: {project['name']}")
Hi, @RUI HAN
The REST API doesn't have built-in functionality for this, and there are no known hidden methods to achieve it directly. However, you can use a workaround: retrieve all projects via the API and then search through the resulting list to find the ones you need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.