It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to create subtasks using REST API

I am able to create JIRA subtasks manually but when I use Postman POST request for doing the same I am getting below error.

"The default assignee does NOT have ASSIGNABLE permission OR Unassigned issues are turned off"

I am following the same steps explained at https://developer.atlassian.com/jiradev/jira-apis/about-the-jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue?_ga=2.266412365.272927713.1514442347-2114113685.1505727766#JIRARESTAPIExample-CreateIssue-Exampleofcreatinganissueusingprojectkeysandfieldnames

Using below data for my POST request:

{
"fields":
{
"project":
{
"key": "XX"
},
"parent":
{
"key": "XXX-3604"
},
"summary": "Some text",
"description": "some text",
"issuetype":
{
"id": "10",
"assignee":
{
"name": "username"
}
}
}
}

Can anyone help me pointing out to the issue as creating subtask is manually possible. Is there any other setting required before creating sub-task through REST API's.

 

Please help, its urgent!

 

4 answers

0 votes
Nic Brough Community Leader Dec 29, 2017

As the error message says, your code is not setting a valid assignee. 

You need to set it to a valid  user, one who has the "can be assigned issues" permission, or leave it out completely and make sure the global setting for "allow unassigned issues" is on.

I'm setting it to a valid user. And after your suggestion I removed assignee value from my POST data. Still getting same error. I also want to mention that I'm able to assign to that user manually.

Also, please tell me how to ensure global setting "allow unassigned issues" is ON.

Appreciate your prompt response.

Nic Brough Community Leader Jan 02, 2018

You clearly are not setting it to a valid user.  The error message clearly states that it is trying to use the default assignee in the project, and that user does not have the right to be assigned issues.

Go back to the basics:

What user is performing this request?  Do they have the right to assign issues?

What username are you sending?  The login id?  Is that user assignable?

The issue is resolved now. It was not because of incorrect user rather the syntax of JSON body I was sending.
I wrote assignee inside the issuetype key but it should be used outside as separate key. It worked after that.
"issuetype":
{
"id": "10"
},
"assignee":
{
"name": "username"
}

Like Dario likes this
0 votes

Hello,

Make sure that you provide user name not the user display name.

I'm using the user name itself. 
Also, as mentioned I tried creating sub task without giving username but still I was getting same error.

Is there any other resolution for the same.

i also have an issue:

 

{
"fields":
{
"project":
{
"key": "TEST"
},
"parent":
{
"key": "TEST-456"
},
"summary": "Sub-task of mycompany-456",
"description": "Don't forget to do this too.",
"issuetype":
{
"id": "5"
}
}
}

 

put json file into variable:value=`cat my.json`

 

curl -D- -u user:pass -X POST --data $value -H "Content-Type:application/json" https://jira.company.com/rest/api/2/issue/

 

curl: (6) Could not resolve host: "fields"; Name or service not known
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: "project"; Name or service not known
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: "key"; Name or service not known
curl: (6) Could not resolve host: "TECH"; Name or service not known
curl: (3) [globbing] unmatched close brace/bracket at pos 1
curl: (6) Could not resolve host: "parent"; Name or service not known
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: "key"; Name or service not known
curl: (6) Could not resolve host: "TECH-456"; Name or service not known
curl: (3) [globbing] unmatched close brace/bracket at pos 1
curl: (6) Could not resolve host: "summary"; Name or service not known
curl: (6) Could not resolve host: "Sub-task; Name or service not known
curl: (6) Could not resolve host: of; Name or service not known
curl: (6) Could not resolve host: TEST-456",; Name or service not known
curl: (6) Could not resolve host: "description"; Name or service not known
curl: (6) Could not resolve host: "Don't; Name or service not known
curl: (6) Could not resolve host: forget; Name or service not known
curl: (6) Could not resolve host: to; Name or service not known
curl: (6) Could not resolve host: do; Name or service not known
curl: (6) Could not resolve host: this; Name or service not known
curl: (6) Could not resolve host: too.",; Name or service not known
curl: (6) Could not resolve host: "issuetype"; Name or service not known
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: "id"; Name or service not known
curl: (6) Could not resolve host: "5"; Name or service not known
curl: (3) [globbing] unmatched close brace/bracket at pos 1
curl: (3) [globbing] unmatched close brace/bracket at pos 1
curl: (3) [globbing] unmatched close brace/bracket at pos 1

{"errorMessages":["Unexpected end-of-input: expected close marker for OBJECT (from [Source: org.apache.catalina.connector.CoyoteInputStream@694ea6e0; line: 1, column: 0])\n at [Source: org.apache.catalina.connector.CoyoteInputStream@694ea6e0; line: 1, column: 3]"

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

1,082 views 7 0
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you