set user properties via API (Postman / Python)

felix.weber
Contributor
July 14, 2021

Hi all,

I am diving into user properties via API ; overall we want to use the user properties to add some user details which want automatically to be added to customfields when creating a ticket.

Therefore at first I need to figure out how to set the user properties via API:(https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-user-properties/#api-group-user-properties )

However the example of Atlassian is very bad as they have added no "value" or better said they do not specify how {propertyKey} needs to be defined (according to other comments it must be JSON).

To start I want to use Postman but I have no clue how the {propertyKey} needs to be set

I have found 2 more or less articles which might help:
https://community.atlassian.com/t5/Jira-Core-Server-questions/How-do-I-access-a-User-entity-s-properties-set-via-API/qaq-p/92490
=> I failed to adapt the curl to postman or python script

https://community.atlassian.com/t5/Jira-questions/Set-User-Property-with-API/qaq-p/796550
=> last comment is that {propertyKey} needs to be JSON but I am missing the full call (maybe just to dump)

When using Postman, e.g. I am not sure if the {propertyKey} needs to be in URL or seperate in Body !?
I have tried e.g PUT https://<Atl_url>/rest/api/3/user/properties?accountId=<myuser>
and in Body:
{"value":"your value"}
and a lot of other tries - can somebody please assist - I guess I am failing at a pretty basic step here

1 answer

0 votes
felix.weber
Contributor
July 14, 2021

Figured out by myself:

Please be aware in Postman you need your Email address and your API code (not the encrypted which you need e.g. using Python!)

set user property:
{propertyKey} will be userproperty1 in the testings below

Method:PUT
URL: https://<instance_url>/rest/api/3/user/properties/userproperty1?accountId=<UserAccountID>
BODY (format as raw): {"value":"your value"}

get ALL user properties:
Method: GET
URL: https://<instance_url>/rest/api/3/user/properties?accountId=<UserAccountID>

get SINGLE user property (here the one which created above)
Method: GET
URL: https://<instance_url>/rest/api/3/user/properties/userproperty1?accountId=<UserAccountID>

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events