Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,584
Community Members
 
Community Events
184
Community Groups

How to get this user property from jira API?

I need to get the value of the personal property bossusername of the user test (as in the screenshot).

lastttt.png

I found an api method to get personal properties of users:

[GET] {url}/rest/api/latest/user/properties/bossusername?username=test

but this method finds nothing.

Then, I decided to create another user-property using the API method:

[PUT] {url}/rest/api/latest/user/properties/newprop?username=test

JSON BODY: "newprop"

now i can get the value of this property via API, but it is not visible through the UI.

It turns out these are two different custom properties that do not see each other. Now I need to add a property through the API so that it can be seen in the GUI.

1 answer

1 accepted

0 votes
Answer accepted
David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 07, 2021 • edited

Hello @Dmitrii Strukov 

That screenshot you've provided looks like the user properties screen for their Jira account. Those are not the same user properties that are used by Jira Server that you can access via the REST API.

When you use:

[GET] /rest/api/2/user/properties?username=test

Does the API return 'bossusername' in the list of available properties for that user?

If not, then you are confusing the two types of 'user properties'. Although it's not stated on the older Jira Server v2 documentation, the Jira Cloud v3 REST API documentation explains this:

Get user property

GET /rest/api/3/user/properties/{propertyKey}

Returns the value of a user's property. If no property key is provided Get user property keys is called.

Note: This operation does not access the user properties created and maintained in Jira.

And, if you go to the Update roles and properties for Jira users page, it also explains the same thing, in reverse:

These user properties are not the same as the user properties accessed via the REST API.

The only way to read or change those user properties like bossusername is via the GUI. If you did create a new property called newprop for that user test in Jira Server, then it will never show up on that screen you have provided.

Tell me please, and what is the API to use to manipulate the custom properties that are visible in the GUI?

David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 10, 2021

Hello @Dmitrii Strukov 

Please read my answer again. You cannot use the REST API to change those custom properties visible in the GUI.

Please read the Update roles and properties for Jira users page, where it also explains the same thing, that you must use the GUI. From that page:

To add data to user properties:

  1. Go to your site's Admin at admin.atlassian.com. If you're an admin for multiple sites or an organization admin, click the site's name and URL to open the Admin for that site.
  2. From the Users page, select the user whose data properties you want to set.
  3. Click the More options button to the right of Log in as user and select Edit Jira properties.
  4. Enter the Key and Value for the user and choose Add.
Like Frederick Claudino likes this

What is the use of having two different kinds of properties? I wanted to create some through the UI and then get them with the API but they actually are two different objects. Not very convenient.

Like # people like this

And what would be the purpose of custom values ​​and not having access to them via API? It looks like you expect our automation to go into the GUI, look at that and say OK, so this is the data.

Like # people like this

Does anyone knows how could you add/change a property of more than 5k users in your instance without the API supporting this?

I mean, please don't tell this is a manual task that I have to perform for each user...

Thanks in advance for any guidance!!

@Frederick Claudino you could use a software/code/library meant to automate browsers.

Open this page https://comutitres.atlassian.net/secure/admin/user/EditUserProperties.jspa?accountId=<accountId> for each user in your list and change/add a property.

Windows PowerAutomate can be the tool (if has a nice GUI).

I personally use Python and Selenium for that purpose, other javascript based packages exist.

In whatever case, this will be about building a custom script.

Like Frederick Claudino likes this

many thanks!!

This helps a lot!

Suggest an answer

Log in or Sign up to answer