Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create Property via REST API to match JSON when Automation for Jira Creates a Property

Jeff Gordon
Contributor
November 29, 2023

Within an A4J rule I am setting an issue property.  When viewing the property using the REST API the JSON is as below.

{
    "key": "myKey",
    "value": "myValue"
}

I need to backfill tickets (one time) with this property and want to use a script with the REST API to add it because it has to do some searching through the changelog to get at the value I want.  Unfortunately after all my efforts I continue to end up with a property whose JSON is this when created with via the REST API.  

{
"key": "myKey",
"value": {
"value": "myValue"
}
}

I simply use a PUT with https://myjira/rest/api/latest/issue/<key>/properties/myKey and a payload of '{"value":"myValue"}'

I use this property (myKey) in another A4J rule.  To get at the value when the property is created by the A4J rule I can simply use {{issue.properties.myKey}}.

However, to get at the value when the property is created via REST API I would have to use {{issue.properties.myKey.value}}.

Bottom line is how do I create the property via the REST API so it has the same JSON as when creating in the A4J?  Anyone with suggestions?  Atlassian's documentation for the properties endpoint is, well, insufficient.

0 answers

Suggest an answer

Log in or Sign up to answer