Retrieve Canned responses in Jira Datacenter from database and REST API


Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

 

Summary

This article describes how to fetch canned responses in Jira DC using Database Query/Rest API.

We have a functionality in Jira Service Management to add canned responses. We can enable/disable this Jira Service Management with "Service Management Canned Responses Plugin". 



Environment

4.12.0, 10.1.2

Solution:

  • Using Database Query
    One way to do this would be to run the following SQL query. It will give you all the canned responses.
Query
SELECT "ID", "SERVICE_DESK_ID", "TITLE", "TEXT"
FROM public."AO_D530BB_CANNEDRESPONSE";

  • Using REST API Call
    Another way to retrieve the JSM canned responses, you can perform a GET request using the REST API at the below specified endpoint:

    <JIRA BASE URL>/rest/servicedesk/canned-responses/1/search/<PROJECT KEY HERE>

    The call above can be run with a curl or a tool like Postman, as detailed in the documentation - Rest API samples and usage guide. The expected output is a JSON file containing the canned responses, as an example:

{
    "cannedResponses": [
        {
            "id": 1,
            "title": "Hello Default",
            "enabled": true,
            "lastUpdatedDate": 1649708480588,
            "lastUpdatedUser": "Admin",
            "createdUser": "Admin",
            "totalUsageCount": 0,
            "content": {
                "text": "Hello,\nThanks for contacting our awesome Support team!",
                "html": "<p>Hello,<br/>\nThanks for contacting our awesome Support team!</p>",
                "unresolvedVariables": []
            }
        },
        {
            "id": 2,
            "title": "Have a nice day!",
            "enabled": true,
            "lastUpdatedDate": 1649708642292,
            "lastUpdatedUser": "Admin",
            "createdUser": "Admin",
            "totalUsageCount": 0,
            "content": {
                "text": "Have an awesome day,\nSupport Agent | Awesome Support",
                "html": "<p>Have an awesome day,<br/>\nSupport Agent | Awesome Support</p>",
                "unresolvedVariables": []
            }
        }
    ],
    "totalHits": 2
}

Last modified on Dec 30, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.