Set the Request Type when creating an issue using REST API in JSM Cloud

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

This article explains the JSON data required to set the customer request type when creating a Jira Service Management request using the Jira Work Management (/rest/api/2/issue or /rest/api/3/issue) endpoint in Cloud.

The correct (and easiest) way to create a Jira Service Management request via REST API is to use the Jira Service Management Cloud REST API 'request' endpoint/rest/servicedeskapi/request.

If you are using Jira Data Center you may want to see the following article instead: How to set Request Type when creating an issue via REST API using /rest/api/2/issue endpoint 

Getting the necessary IDs

To get a list of the request type keys needed for this operation, first, you need to get the Issue ID of any existing issue in the relevant project, and then use it to get the values.

1. Go to your project and click on any issue.

2. Edit the URL to the following format, keeping the issue key:

https://<yourinstanceurl>.atlassian.net/rest/api/2/issue/<issuekey> 

3. Search for "id" and copy its value (this id is numerical)

4. Go to the URL below to get the list of request type keys (use the issue ID copied in step #3)

https://<yourinstanceurl>.atlassian.net/rest/servicedesk/1/servicedesk/request/<issueid>/request-types

Note that this is an internal endpoint that is not officially documented and can change without prior notice.

Combine the values to form the Request Type ID

Once you get a list of the existing request types in your project, you can combine the values of "portalkey" and "key" attributes in the body of your API request as the value of the Request Type field. The correct format is "portalkey"/"key".

  • Examples of valid values:
    • "sda/getithelp"
    • "sda/36fc55b4-df3e-4c73-9481-9470d545678a"

Each request type is based on an issue type and can only be selected for issues of the associated type. If the chosen request type isn't based on the correct issue type, it will result in an error. 

Now, to set the value for the Request Type field when creating an issue via API, you will need the Request Type custom field id. You can get this id by accessing the address below (using any valid issue key) and searching for "Request Type":

https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names

Make sure that the Request Type is added to the Create issue screen.


Here is a sample JSON data that works:

{
    "fields": {
        "project": {
            "id": "10205"
        },
        "summary": "Something's wrong",
        "issuetype": {
            "id": "10100"
        },
        "priority": {
            "id": "1"
        },
        "components": [
            {
                "id": "10000"
            }
        ],
        "customfield_10202": "sda/getithelp"
    }
}


We have an open Feature request to have the official REST API endpoint including the request type key:

JSDCLOUD-4917 - The REST API endpoint /rest/servicedeskapi/servicedesk/{serviceDeskId}/requesttype should include the request-type Key in the response

Last modified on Feb 13, 2025

Was this helpful?

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