Home > Back-end >  Jira REST API for configuring dashboard gadget
Jira REST API for configuring dashboard gadget

Time:07-17

My goal is to create dashboard gadgets automatically and programatically. I tried to create dashboard gadget, Filter Results, using jira rest api (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-dashboards/#api-rest-api-3-dashboard-dashboardid-gadget-post). However, there isn't any parameters to set 'Saved filter', 'Number of results' or 'Columns to display' for Filter Results gadget in the api. The only thing I can do with the api is create an empty gadget. How can I configure gadgets using api?

CodePudding user response:

ScriptRunner has some support for this https://scriptrunner.adaptavist.com/latest/jira/recipes/dashboard-gadgets.html

CodePudding user response:

I use jira api, set dashboard item properties, to configure gadgets (dashboard item).

payload = json.dumps({
    "filterId": "10711",
    "num": "50",
    "columnNames": "issuetype|summary|issuekey",
    "refresh": "true",
    "isConfigured": "true"
})

res = requests.request(
    "PUT",
    f"{HOST}/rest/api/3/dashboard/{dashboard_id}/items/{item_id}/properties/config",
    headers={
        "Accept": "application/json",
        "Content-Type": "application/json"
    },
    data=payload,
    auth=HTTPBasicAuth(EMAIL, TOKEN)
)

Thanks for the answer from Atlassian Community.

  • Related