Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,293
Community Members
 
Community Events
184
Community Groups

How to create ticket and comments on behalf of another user via REST API?

I am using a service account and have the use case of creating ticket and comments on behalf of another user via REST API. Currently, I am unable to figure out any API example or way to do the same.

2 answers

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 07, 2021

Hi @AVNISH ANAND  -- Welcome to the Atlassian Community!

You may want to search in the developer community for ideas about this topic:

https://community.developer.atlassian.com/

Best regards,

Bill

Hey Bill, with all the due respect, that's a pretty useless answer as the general community is now so bloated and full of out-of-date answers that it is not particularly easy to find anything there.

For other people finding this question, here is how far I made it, maybe it will help somebody, or maybe somebody could kick me even further:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post describes vaguely how to create an issue.

1) First, follow the beginning of that description to get to a point where you have your user credentials

2) Then, replace the xxx with your actual values, and run:

curl --request GET \
--url 'https://xxx.atlassian.net/rest/api/3/issue/createmeta' \
--user 'xxx:xxx' \
--header 'Accept: application/json'

-> it will tell you what are the `issuetype.id`, `project.id` numbers you want in the next step.

3) Run

curl --request POST \
--verbose \
--url 'https://xxx.atlassian.net/rest/api/3/issue' \
--user 'xxx:xxx' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"update": {},
"fields": {
"summary": "Main order flow broken",
"issuetype": {
"id": "XXX"
},
"project": {
"id": "XXX"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Order entry fails when selecting supplier.",
"type": "text"
}
]
}
]
},
"reporter": {
"id": "XXX"
},
"labels": [
"test"
]
}
}'
sorry for the broken formatting, I'm sure you can prettify it. The code above hasa total of six XXX bits you need to replace with your values.
---
This brings me to how did I even find this discussion thread:
1. I have no idea what my `reporter.id` should be, when I'm creating a new issue on behalf of a random customer
2. The docs don't describe what is the shape of the payloads. Showing a link on a word "object" explaining that additional properties of that object could be "anything" is not technically wrong, but is entirely useless.
I'm sure this is somehow all my fault, caused by lack of knowledge of the API, but all I wanted is to work out what is the API call I need to make to create a ticket on behalf of a website visitor, so that I don't have to send an email, or use one of the ugly data collectors.
To be fair, I expected this to be part of an API that can be used anonymously, since creating an issue through sending an email needs no authentication either. I also expected this to be a single API call with some basic (but documented) JSON body.
Instead I found that I need to bind my own (admin-level) user account with the operation, by creating an API key. Alternatively, I can create a new user, start paying for it, and then use that user to create these tickets. That is, of course, if I ever made it to the point where I actually know what the API call is.
Phew. Sorry for the rant. It's 2022 and APIs should no longer be difficult to use.
Like Kaare Moe likes this

Update #1. Changing the `reporter.id` to `reported.email` makes the API call go through, and the issue is created, but the requester is Anonymous.

I could attempt to create the user, but that would definitely mean I need to use API key with significant access. I don't wish to use API key that can manage my Jira users.

Hi Jan, with "reporter.email" I get "anonymous" in the ticket

@Jan Klan @Adrián Eduardo Giacometti Brussolo  did you find a way to use the API to create tickets on-behalf of existing users?

Suggest an answer

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

Atlassian Community Events