Project properties is empty in Jira expression

Hi,
I am trying Jira expressions.
On my dev instance the following rest for project props - /rest/api/2/project/10033/properties return a list with 2 properties

When I try to get the same info using jira expressions - rest/api/2/expression/eval?expand=meta.complexity with data:

{
  "expression": "{ projectProps: project.properties, project: project }",
  "context": {
    "project": {
      "id": "10033"
    }
  }
}

The “properties” are empty:

project: {
...
  id: "10033"
  properties: {}
...
},
projectProps: "Properties of Project"

Am i missing some configuration for jira expressions rest? Or maybe the properties in eval and “properties” rest are different?

Hi, @Efrosina,

project.properties returns the EntityProperties object, which itself is not serialized to anything useful when returned from the REST API. You can interact it with it to get a property with a given key or a list of all property keys. You could do, for example:

project.properties
       .keys()
       .map(k => 
            { 
               key: k, 
               value:  project.properties[k] 
            })

Which would return a list of all properties along with their values. Keep in mind that that expression would fail for projects with more than 10 properties, since loading a property is an expensive operation. Hence, when retrieving properties with Jira expressions, make sure you have a predefined not-too-large set of keys you are interested in.

1 Like