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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.