evaluateJiraExpression method
- String? expand,
- required JiraExpressionEvalRequestBean body,
Evaluates a Jira expression and returns its value.
This resource can be used to test Jira expressions that you plan to use elsewhere, or to fetch data in a flexible way. Consult the Jira expressions documentation for more details.
Context variables
The following context variables are available to Jira expressions evaluated by this resource. Their presence depends on various factors; usually you need to manually request them in the context object sent in the payload, but some of them are added automatically under certain conditions.
user
(User): The current user. Always available and equal tonull
if the request is anonymous.app
(App): The Connect app that made the request. Available only for authenticated requests made by Connect Apps (read more here: Authentication for Connect apps).issue
(Issue): The current issue. Available only when the issue is provided in the request context object.issues
(List of Issues): A collection of issues matching a JQL query. Available only when JQL is provided in the request context object.project
(Project): The current project. Available only when the project is provided in the request context object.sprint
(Sprint): The current sprint. Available only when the sprint is provided in the request context object.board
(Board): The current board. Available only when the board is provided in the request context object.serviceDesk
(ServiceDesk): The current service desk. Available only when the service desk is provided in the request context object.customerRequest
(CustomerRequest): The current customer request. Available only when the customer request is provided in the request context object.
Also, custom context variables can be passed in the request with their types. Those variables can be accessed by key in the Jira expression. These variable types are available for use in a custom context:
user
: A user specified as an Atlassian account ID.issue
: An issue specified by ID or key. All the fields of the issue object are available in the Jira expression.json
: A JSON object containing custom content.list
: A JSON list ofuser
,issue
, orjson
variable types.
This operation can be accessed anonymously.
Permissions required: None. However, an expression may
return different results for different users depending on their
permissions. For example, different users may see different comments on
the same issue.
Permission to access Jira Software is required to access Jira Software
context variables (board
and sprint
) or fields (for example,
issue.sprint
).
Implementation
Future<JiraExpressionResult> evaluateJiraExpression(
{String? expand, required JiraExpressionEvalRequestBean body}) async {
return JiraExpressionResult.fromJson(await _client.send(
'post',
'rest/api/3/expression/eval',
queryParameters: {
if (expand != null) 'expand': expand,
},
body: body.toJson(),
));
}