...
...
...
...
...
REST Service Caller has 4 main parts.
Script for execution
In this section, you can give a decision to execute REST according to the result of Groovy script.
By default, it has only "return true" statement. However, you can type your script and return true: to execute REST, or return false: not to execute
Below, there is a sample code on how you can type your own script.REST Service Details
In this section, REST details (URL, method, headers, body, credential, ..) are filled.- URL: The endpoint of the REST service. You can type any dynamic parameter here using double curly braces. (e.g. http://mycompany.com/api/book/{{bookId}} assuming bookId is defined in Parameters section which is described below)
- Method: Select Http Method (GET, POST, PUT, DELETE)
- Headers: Define your HTTP header key/value sets in separate lines as described in screen-shot
- Request Body: Type json request body. You can use dynamic parameters here as well
Parameters: Define all your dynamic parameters here. You can add static values as well as the dynamic values of fields/custom fields in JIRA issue. Here are some sample usages:
Code Block assignee = $issue.assignee or {{issue.assignee}} reporter = {{issue.reporter}} date = $issue.created productName = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_11100')) price = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_11102')) displayName = $user.displayName comment = $comment // this is the comment that is passed throught the transition
Please
...
see User
...
and Issue
...
API for all properties and methods.
- Authorization Type: Choose authorization type. Currently BASIC Authentication is supported.
- Credential: If you choose any Authorization Type, this option becomes active, and the credentials you defined in Credentials
...
- section are listed.
Once, you click on OK button, it saves all configuration.
Updating a customfield with a value in REST result
...
- Below is the sample screenshot
Post operations
In this section, you can configure to update a custom field
...
- based on a value in REST response
...
- First click on Update custom field checkbox
- Custom field drop down is displayed, select the one you want to update
- Type jsonpath accordingly to select the value. If the result is not json and you want to update custom field with the body itself, just leave this textbox empty.
...
page for jsonpath samples.
Run asynchronously?
In this section, you can enable async to execute REST service asynchronously. There are a couple of reasons why you may want to execute asynchronously.
Executing synchronously makes user wait for the transition longer than usual. If the host of the REST service responds late or there is a connection time out between JIRA server and the host, the users waits for the spinner a lot. So, it may be wise to enable async if your REST service responds slow
- Some issue parameters may wait for calculation or reindexing. Some plugins may work background to populate the actual result of a custom field and you may want to use that value.
Once, you click on OK button, it saves all configuration.
Please do not forget to publish workflow to see it in action.