Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

276
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda