Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
Create/Update Subtask for a Jira Story

I am new to Jira API & I am currently creating a google form to create a subtask automatically for any ad-hoc requests attaching to an existing story that is already created manually.

URL: https://<subdomain>.atlassian.net/jira/software/c/projects/<PROJECTID>

STORY CREATED: PROJECTID-XXX

I have the following sample code to test:

function createSubTask(summary, description) {
  var URL = 'https://<subdomain>.atlassian.net/rest/api/3/issue';
  var username = '<user-name>';
  var password = '<api-key>';
  var userCreds = "Basic " + Utilities.base64Encode(username + ':' + password);
  var data = {
    "project": {"key": "PROJECTID"},
    "parent": {"key": "PROJECTID-XXX"},
    "summary": summary,
    "description": description,
    "issuetype": {"name":"Sub-task"}
  };
  var payload = JSON.stringify(data);
  var headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": userCreds,
    "muteHttpExceptions": "True"
  };
  var options = {
    "method": "POST",
    "headers": headers,
    "payload": payload
  }
  var response = UrlFetchApp.fetch(URL, options);
  Logger.log(response);
}

I am getting the following error:

Exception: Request failed for https://<subdomain>.atlassian.net returned code 400. Truncated server response: {"errorMessages":[],"errors":{"project":"Specify a valid project ID or key"}} (use muteHttpExceptions option to examine full response)

Not sure, what I am doing wrong.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use the following payload format. It will fix the problem.

{
    "fields": {
       "project":
       {
          "key": "TEST"
       },
       "summary": "REST ye merry gentlemen.",
       "description": "Creating of an issue using project keys and issue type names using the REST API",
       "issuetype": {
          "name": "Bug"
       }
   }
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!