Creating sub-task in JIRA Cloud using REST API

I’m just getting started with Jira Cloud development and I’m trying to create a new subtask using Rest API.
Here is what I’m trying to do:
curl -D- -u admin:admin -X POST --data “data=@//subtask.txt” -H “Content-Type: application/json”
subtask.txt file contains the payload including the required issue type.

I’m getting bunch of html back that includes:

Unauthorized (401)

Do I need to configure something in my Cloud Jira instance to enable basic Auth?

Any thoughts?

thanks, Roman

I can’t explain the 401. You don’t have to do anything on JIRA Cloud to enable Basic auth. But when I used your curl example, I got a 400 because the curl syntax for --data was wrong. Here’s what worked for me:

curl -D- \
    -X POST \
    --data @subtask.txt \
    -H "Content-Type: application/json" \

thank you for the follow-up, Ian!
Unfortunately It has not helped me, however I now wonder if I’m using incorrect URL for ${JIRA_BASE_URL}.
my full URL looks like this:

Does it make sense?

That does look correct. And admin is the default first user name for every JIRA instance, so that also looks correct. If we’ve ruled out everything else, the 401 seems to best indicate that you have entered a wrong password.

1 Like