We are attempting to programmatically create Service Requests in our Jira Service Management project (Project Key: [YOUR_JIRA_PROJECT_KEY], Service Desk ID: [YOUR_JIRA_SERVICE_DESK_ID]) using the Python jira
library (official Jira Python client).
Our Goal:
We need to automate the creation of Service Requests with a specific Request Type within our Jira Service Management project. For example, we have a Request Type named '[YOUR_REQUEST_TYPE_NAME, e.g., MDC]' (Request Type ID: [YOUR_REQUEST_TYPE_ID, if you found it, e.g., from API script output]).
What We Have Tried and What is Working:
jira
library.serviceDeskId
and requestTypeName
(or requestTypeId
) parameters in the jira.create_issue()
method, the issue is created successfully, but the specified Request Type is not applied to the newly created issue. It defaults to a generic Service Request without the specific Request Type we intended.The Problem/Challenge:
Despite including the serviceDeskId
and requestTypeName
(or requestTypeId
) parameters in our jira.create_issue()
call, the Request Type is consistently not being applied. We have tried:
serviceDeskId
for our JSM project is being used.We are using the following structure in our Python code for issue creation (simplified example):
from jira import JIRAa # ... (Jira connection setup with basic_auth) ... issue_dict = { 'project': {'key': '[YOUR_JIRA_PROJECT_KEY]'}, 'issuetype': {'name': '[System] Service request'}, # or 'Service Request' 'summary': 'Test Service Request Creation with Request Type', 'description': 'Programmatic test...', } new_issue = jira.create_issue( fields=issue_dict, serviceDeskId='[YOUR_SERVICE_DESK_ID]', requestTypeName='[YOUR_REQUEST_TYPE_NAME]' # OR requestTypeId='[YOUR_REQUEST_TYPE_ID]' )
Hi @gastori , welcome to the Atlassian Community!
Are you using the correct endpoint for JSM?
'url = "https://your-domain.atlassian.net/rest/servicedeskapi/request" '
JSM API is different from the general Jira API, and using wrong endpoints might result in fallback to defauls
Check the docs: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-post
I am using the Jira Python module https://jira.readthedocs.io/index.html. I am not invoking Jira Rest API.
Should I use the native Resat API?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In my opinion in general it is better to go to the source. Especially since there are python examples in docs. You won't be limited by the library and get access to latest api.
I've asked chat GPT about hints to solve this and this is the part of the reply (but verify it yourself):
Important Notes:
1️⃣ Use /rest/servicedeskapi/request instead of the standard Jira issue creation endpoint.
2️⃣ The jira library does not natively support JSM request creation, so you need to use jira._session.post().
3️⃣ Make sure your user has the correct permissions to create requests in JSM.
4️⃣ Always test with a small request before automating in production.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. I think I go with the native Rest API to get a better support and latest updates. I just hate to deal with assembly the https payload. A python module simplifies the code by abstracting all the raw constructs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.