Forums

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

How to assign a task to a user while creation itself using REST api

kanwarrobinson_salethraja
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!
May 22, 2024

I am creating a jira ticket using the REST api with a payload given below

{
        "fields": {
        "project": {
            "key": "TP"
         },
        "summary": "Sample issue created via Curl",
        "description": "This is a test issue created using the Jira Curl command",
        "issuetype": {
            "name": "Task"
        },
        "assignee": {
            "name": "kanwar.robinson"
        }
    }
}

but the ticket is sucessfully created but the assignee in the ticket is unassigned

but i am able to do the assigning while creation in UI itself

can anyone tell if i am missing any permissions or something else??

2 answers

1 vote
Hector Florin
Contributor
May 22, 2024

Hi @kanwarrobinson_salethraja ,

Welcome to the Community.

The way you're using your REST endpoint to assign a user with the display name is used on the On-premises.

As you are using Cloud, you need to pass the assignee id or account Id with the following format

"assignee":{"id":"71231299ajsdasd123123"}

 

instead of   

"assignee": {"name": "kanwar.robinson"}

 

PS: You can get the Assignee Id when checking the User's profile.

 

Additionally, you can achieve this and access to more REST services by using a 3rd Party App, like Power Scripts that can be really helpful to automate your workflows.

 

I hope it helps.

Thank you.

Regards,
Hector

0 votes
Kalyan Sattaluri
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 22, 2024

Hello @kanwarrobinson_salethraja 

Please pass the accountID instead of name like below:

"assignee": { "id": "5b109f2e9729b51b54dc274d" }

Also, tickets gets assigned to Project Lead if you are not passing a default value, so maybe check the Jira project configuration as well.

Suggest an answer

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

Atlassian Community Events