Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved]Buik change dashboard owner use REST API

Haishen April 24, 2025 edited

 

Update: Need add "extendAdminPermissions": true in request body to change dashboard owner

 

Hi guys

I'm trying to delete hundreds of private dashboards as admin, but #api-rest-api-3-dashboard-id-delete gives me error about "You may only create, modify or delete dashboards that you own."

so I try to change all of those dashboard's owner to myself, use #api-rest-api-3-dashboard-bulk-edit-put with below payload:

{
"action": "changeOwner",
"entityIds": [
110000,
111111,
222222
],
"changeOwnerDetails": {
"autofixName": true,
"newOwner": "1a2b3cxxxxxxx" (got this by accountId in #api-rest-api-3-myself-get)
}
}

but it returns with error message:  "Only admin or owner of dashboard can change owner."

I'm very sure about the admin part, as I can change owner of those dashboards in admin page, anything wrong with my API request?

This is the curl format of my request:

curl -X "PUT" "https://aspiraconnect.atlassian.net/rest/api/3/dashboard/bulk/edit" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u 'username:password' \
-d $'{
"action": "changeOwner",
"entityIds": [
11111,
22222,
33333
],
"changeOwnerDetails": {
"autofixName": true,
"newOwner": "1a2b3cxxxxxxx"
}
}'

 

 

 

2 answers

1 accepted

4 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2025 edited

Hi @Haishen 

I understand you are trying to change the owner of a dashboard via the REST API.  However given the error, I think the problem might be more of an authorization problem with REST.  I tested this in my own site, and found I could change the owner with a curl request like this one:

curl --request PUT \
--url 'https://[mycloudsite].atlassian.net/rest/api/3/dashboard/bulk/edit' \
--header 'Authorization: Basic [encoded key redacted]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"action": "changeOwner",
"entityIds": [
10100
],
"extendAdminPermissions": true,
"changeOwnerDetails": {
"autofixName": true,
"newOwner": "my atlassian account id"
}
}'

For my result, curl returned a statement of:

{"action":"changeOwner","entityErrors":{}}%

And I then found these private dashboards were visible to my user as the owner.

 

There is one parameter my request has that yours does not,

"extendAdminPermissions": true,

Try adding that to your request. It's possible you are a Jira Admin, but might not be a site-admin, in which case there might be a permissions limitation here. If it's still not working, then try the steps below:

In your example, I see you appear to be using the -u switch. I'd recommend instead generating an API Token first.  And then following the guide closely in https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

This alternative authorization method suggests taking your email address, pairing that value with the token, and then encoding it in a base64 string that you can then pass as a header instead of using the -u switch. 

Andy

Haishen April 28, 2025

A big thank you to Andy.

Adding

"extendAdminPermissions": true

was exactly what I was missing. After adding this field, changing the owner succeeded. Now I can delete those hundreds of dashboards. Thank you very much!

Like 2 people like this
0 votes
Kristian Walker _Adaptavist_
Community Champion
April 28, 2025

Hi Haishen,

Your curl request looks correct, comparing it to the API docs.

I have requested Atlassian support take a look at this request to see it they can suggest further, why it is not working as expected.

I hope this helps.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events