Update mail for all users - JIRA CLOUD

Hello

i would like to update the mail adresse to one user in jira cloud with API REST

i have follow this article : https://developer.atlassian.com/cloud/admin/user-management/rest/api-group-email/#api-group-email

but the command “curl” dont worked i have set this in postman

now : testingoss000@gmail.com to => testingoss000@yahooocom it’s an example

this command don’t worked
Have you idea ?

Thanks in advance

Are you trying to change the email address of a managed (verified) account? If so, what error do you see when you run the curl command?

Hello

yes its account verified it’s all ok im administrator to this jira cloud and when i set this command :
PUT https://xxxxx.atlassian.net/users/id-user/manage/email - d {“email” : “name@name.com” } and header etc…

i have this error :
405Method Not Allowed

Hello @SalimHammar

I can provide an answer on behalf of @SalimHammar

The REST API endpoint you’re interacting with is not for administering Jira Cloud user accounts, it is for administering managed user accounts within an entire Organization via the Cloud Admin APIs. The path to that endpoint does not start with https://xxxxx.atlassian.net/ but starts with https://api.atlassian.com/. This is stated on the About page of the documentation.

Also, I suggest that you read more about those endpoints, since they are reserved for use by Organization Administrators only and require a special API token to access. You cannot access those endpoints using your Jira Cloud Administrator user account. This is stated in the Manage an Organization with the admin APIs documentation.

2 Likes

Hello @sunnyape

Thank for your answer, i undestand better , i have created a new api here :

https://admin.atlassian.com/o/xxxxxxxxx/admin-api

and i have set this :
curl -k -u “mail-admin:api_token” -X GET “https://api.atlassian.com/users/id-user” -H “Accept: application/json” and i have this error :

{“code”:401,“message”:“Unauthorized”}

i have set this command for test the connection like this : https://developer.atlassian.com/cloud/admin/user-management/rest/intro/#about

You know why ?
Thanks in advance

@SalimHammar,

The clue is the 401 status for Unauthorized. API Tokens for the Cloud Admin APIs are Bearer tokens, not Basic auth. You can’t use curl’s user (-u) option.

curl --request GET \
  --url "https://api.atlassian.com/users/${ACCOUNT_ID}/manage/profile" \
  --header "Authorization: Bearer ${ACCESS_TOKEN}" \
  --header "Accept: application/json"

Hi @ibuchanan

Thank you for your answer and your help.

i have fix my command line and now i have this error , i think it’s same error no ?

{“key”:“forbidden”,“context”:“Error: Caller must be a verified org admin of targeted account or be the targeted account”,“errorKey”:“forbidden”,“errorDetail”:“Error: Caller must be a verified org admin of targeted account or be the targeted account”}

@SalimHammar,

This is not the same error and it does tell us something different. I think the error message might be wrong though. I cannot access my own profile through this API, even if the error message makes it seem like I can.

Are you an org admin for your company? And have you claimed your domain and added an IdP? For more details see my prior similar post:

@SalimHammar

In addition to what @ibuchanan has said, I suggest you use the Get user management permissions endpoint first to know what permissions you have in respect to that user account. You simply might not have profile.read permissions, hence that error message you got when trying to read that user’s profile via the Get profile endpoint.

Also, use the Get managed accounts in an organization endpoint to find out whether or not that user’s account you are trying to administer is or isn’t a MANAGED account.

In closing, I VERY STRONGLY SUGGEST that you spend some time reading the documentation about these APIs and learn about what they are used for, how to use them and who should be using them, as it seems to me that you are mostly just making random guesses and the consequences of mis-using this APIs can be fairly dramatic.

Good luck on your learning journey. Bye!

Hi

okay , thank you for all everyone :slight_smile:

Hey @SalimHammar Is this issue is resolved?