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

Get custom user properties with API

valerian Baillet May 2, 2018

Hi,

Is it possible to get the user properties with the JIRA API.

I try to custom the customer portal with some javascript and I need this informations

 

Can you help me ? 

 

Best regards

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
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.
May 2, 2018

If you want to get user properties using Java Script, then you should use REST API. You can use GET /rest/api/2/user/properties

You can find more info here:

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/user/properties

valerian Baillet May 3, 2018

Hi 

thanks for your answer I finally get the informations.

I saw that I have to create the properties with a  PUT /rest/api/latest/user/properties/ but when I try this method I had a 405 error .

I try with the post method and it's not work.

Don't you know where it comes from?

For information: this is the code I use :

 var user = getCurrentUserData(); var userCredentials = "userCredentials" AJS.$.ajax({ url: `/rest/api/latest/user/properties/`, type: "PUT", dataType: "json", async: false, headers: { "Authorization": "Basic " + userCredentials, "Content-Type": "application/json", 'X-Atlassian-Token': 'nocheck' } data: { valideRGPD: "false", userKey: `${user}` } }).done(function (data) { alert("Success"); }).fail(function () { alert("Failed"); });

 

Alexey Matveev
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.
May 3, 2018

Your rest call is not correct. You should use

PUT /rest/api/2/user/properties/{propertyKey}

but you use

/rest/api/2/user/properties/ which is the GET method and you get the error, that the PUT method does not exist.

valerian Baillet May 3, 2018

So if I understood what you say I need to use the following url:

/rest/api/latest/user/properties/valideRGPD

to create the properties valideRGPD and set the value in the data field ?

Alexey Matveev
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.
May 3, 2018

That is right.

valerian Baillet May 3, 2018

ok thank you for your reply, I will test this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events