JIRA Configuration REST API
This REST API endpoint allows anyone with the System Administrator role or the Edit System Configuration and Users permission to manage JIRA configurations for notifications.
Note
This REST API endpoint can be used with Jira Cloud, Jira Server, or Jira Data Center. Jira Server and Data Center users are encouraged to use the Sonatype for Jira integration for advanced features.
JIRA Configuration Properties
Property | Required | Description |
---|---|---|
url | Yes but only for creation. | The JIRA server address. |
username | No unless the JIRA server requires an authenticated user to create issues. | The username used to connect to the JIRA server. |
password | No unless the JIRA server requires an authenticated user to create issues. | The password used to connect to the JIRA server. |
customFields | No unless the JIRA project issue type requires them. | Any JIRA project issue type required fields without default values defined in JIRA. |
GET the JIRA Configuration
To get the JIRA configuration you can make a GET request to the following path:
GET /api/v2/config/jira
Below is an example request to a local IQ Server using the built-in administrator account and the cURL tool:
curl -u admin:admin123 http://localhost:8070/api/v2/config/jira
If no JIRA configuration is saved, then the request yields HTTP status code 404. Otherwise, a JSON response with all the properties described above except for password is returned.
PUT the JIRA Configuration
To set the JIRA configuration you can make a PUT request to the following path:
PUT /api/v2/config/jira
The request requires a JSON body as payload.
If the JIRA configuration is being created for the first time, then the url is required and all other properties are optional. Although if supplying credentials, then a username and password must be supplied together.
If the JIRA configuration already exists, then any supplied properties will update their values to the given values.
Note
If updating the url for an existing JIRA configuration that has credentials defined, then credentials must also be supplied. These credentials do not have to match the existing credentials but will replace the existing credentials. Supplying a null
username and null
password will remove the credentials.
Below is an example request to a local IQ Server using the built-in administrator account and the cURL tool:
curl -u admin:admin123 -X PUT -H "Content-Type: application/json" -d '{"url": "http://localhost:8080", "username": "admin@test.com", "password": "admin123", "customFields": {"reporter": {"id": "123:abc-123-abc"}}}' http://localhost:8070/api/v2/config/jira
A successful request yields HTTP status code 204. Note that the reporter account id can be obtained from the Jira users api at /rest/api/3/users or from the url of user account profile in Jira.
DELETE the JIRA Configuration
To delete the JIRA configuration you can make a DELETE request to the following path:
DELETE /api/v2/config/jira
Below is an example request to a local IQ Server using the built-in administrator account and the cURL tool:
curl -u admin:admin123 -X DELETE http://localhost:8070/api/v2/config/jira
A successful request yields HTTP status code 204.