Why can't I see user property set through Jira REST API on user profile page

Mattias Kallvi August 9, 2018

Hi,

I created a small program to set a user custom property using the Jira REST API. In my example program I created a custom property for a user, "FavouriteTune" with the value "Fools gold". It all worked fine, I can retrieve and update the property using the REST API.

However, when I look at the user profile page in Jira there are no custom properties besides the one created through the GUI. Am I doing something wrong here, like missing a call? Or is it not possible to view custom properties set through the API?

Any help on this would be great. I need to update 1000+ user profile properties and I don't want to do this using the GUI or database update.

//Mattias

1 answer

1 accepted

2 votes
Answer accepted
Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 10, 2018

Hello, Mattias.

Unfortunately, the properties set in the GUI and the properties set by the REST API are two different things, I know, the names makes it very confusing.

There was this bug opened to report this, but as you can see it was resolved as "not a bug" and there's a comment explaining the situation. Basically, as I've mentioned, those two properties are two different things, the REST API one was created to be used by add-ons to store per-user data and settings.

We've raised a feature request so a REST API could be implemented for the properties used by the GUI:

So, the solution is to use just one of the options, GUI or REST API, as they don't correspond to one another. Thinking that this could not be an option I tried to find if there was an endpoint in the GUI that we could use, but I was not able to actually make a PUT call and change the property(I used the CURL Linux command).

Let me know if your insight on this situation.

Kind regards,
Maurício Karas

Mattias Kallvi August 12, 2018

Hi,

Thank you for confirming my suspicion. I guess this leaves me with 3 options:

  • Update each user in the GUI. This will take a long time...
  • Update the database directly, which is not recommended.
  • Develop some kind of custom field to show my custom user properties.

I Think we will put this on hold for a while.

Regards,
Mattias

Peter Daugavietis [Adaptavist] March 5, 2020

Realizing this message is old, this might still help (or at least others).   Using the Jira Java API you can create properties visible in GUI:

import com.atlassian.jira.component.ComponentAccessor

def userPropertyManager = ComponentAccessor.getUserPropertyManager()
def userManager = ComponentAccessor.getUserManager()

def admin = userManager.getUserByName("admin")

userPropertyManager.getPropertySet(admin).setString("jira.meta.anotherProperty","123123")

The trick here seems that the prefix "jira.meta.xxxx" makes them visible on the GUI (the GUI seems to drop the prefix, and the property becomes just "xxxx" (or 'anotherProperty' in the example).

This doesn't solve the issue of GETTING those values back out, so I'm still going to use the REST API methods since I'm trying to do things programatically.  Using the above and wrapping it in a Scriptrunner REST service might still work well for documentation purposes.

 

Thx - pd

Like # people like this

Suggest an answer

Log in or Sign up to answer