Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a Service Desk Ticket using the Service Desk API?

gabriel_silfa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 2, 2021

I've been trying to create a ticket using the Service Desk API, but I can't get this done.

I'm currently using this with Python:

url='https://penadefillo.atlassian.net/',
username='Username',
password='password',
cloud='True'

 I've been trying to use this URL, but have gotten no results:  https://penadefillo.atlassian.net/rest/servicedeskapi/servicedesk/{}/requesttype

Pplease, a response would be appreciated, thanks in advance!

1 answer

1 accepted

7 votes
Answer accepted
Mikael Sandberg
Community Champion
December 2, 2021

Hi @gabriel_silfa,

Welcome to Atlassian Community!

You have to include the service desk ID and the request type ID as part of the body in your request, not in the header.  

This is what it looks like if you are using curl

curl --request POST \ 
--url
'https://your-domain.atlassian.net/rest/servicedeskapi/request' \
--header
'Authorization: Bearer <access_token>' \
--header
'Accept: application/json' \
--header
'Content-Type: application/json' \
--data
'{
"serviceDeskId": "10",
"requestTypeId": "25",
"requestFieldValues": {
"summary": "Request JSD help via REST",
"description": "I need a new *mouse* for my Mac"
}
}'

Also note that using password as part or your authentication is being deprecated, instead you should create an API token.

Have a look at the REST API documentation for more information.

gabriel_silfa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 6, 2021

Hi, sorry for the long wait. Thanks for answering! We are going to change the way we connect to Jira, we didn't know it was going to be deprecated.


We are going to use the OAuth 2.0 Code Grant to authenticate with the Jira Service Desk API, but we are having issues with the authorization URL. We're trying to connect an external system with Jira Service API to create tickets and retrieve information from it.

What we don't understand is the state parameters, we're using this as a base URL: https://your-domain.atlassian.net/api. Changing the "your-domain" with ours of course, but we still can't connect, any ideas about what we are doing wrong?




Mikael Sandberg
Community Champion
December 6, 2021

It's hard to say what exactly is wrong without seeing the code or the response, but make sure that you are sending the right headers with your request. From the example I posted above you have to include your authentication in a header, and the data you want to add to your request in the data header. I would recommend that you check out the API documentation and it also has examples. I can also recommend that you check out the Developer Community as well.

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events