Forums

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

"Specify a valid project ID or key" exception while creating an issue from Google Script

Zet
October 19, 2023
I'm trying to create an issue in my Jira (Cloud) project with URL Fetch in Google Script.
The main code is:

    issue = {
        "fields": {
          "issuetype": "Task",
          "summary": "Summary",
          "reporter": {"displayName": "John"},
          "priority": "Medium",
          "project": {"key": projectKey}
        }
      };
    UrlFetchApp.fetch(jiraUrl, {
      method: "POST",
      headers: {
        'Content-Type': "application/json",
        "Authorization": "Basic " + Utilities.base64Encode(userName + ':' + apiToken)
      },
      payload: JSON.stringify(issue)
    });

When I run it, I get a 400 exception: Truncated server response: {"errorMessages":[],"errors":{"project":"Specify a valid project ID or key"}}
However, I'm pretty sure that I put the correct key (shows in the issue datas I got from my Jira project in the same URL Fetch way) of my project into the line ("project": {"key": projectKey})
And I also tried using "project": {"id": projectId}, but still the same exception.
I have found similar questions and reports about this exception on the Internet. But it seems no effective solution mentioned ever.

1 answer

1 accepted

2 votes
Answer accepted
Lizzie_Rogers
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 Champions.
October 25, 2018

If you're in a ticket with a label, and click on that label, it'll pull up a search of all tickets with that label.

You can also go into Issues > search for issues and search there.  JQL: labels = "ABC"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events