You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
function makePostRequest() {
var data = { "fields": { "project":{ "key": "****" }, "priority": { "name": "Medium" }, "duedate": "test", "summary": "summary", "description": "description", "issuetype":{ "name": "Task" } }};
const url = "https://*****.atlassian.net/rest/api/latest/issue"; const response = UrlFetchApp.fetch(url, { "method": "POST", "headers": { "X-Atlassian-Token" : "no-check", "Authorization": "Bearer ************", "Accept": "application/json", "Content-Type": "application/json" }, "muteHttpExceptions": true, "followRedirects": true, "validateHttpsCertificates": true, "contentType": "application/json", "payload": JSON.stringify( { "fields": { "project":{ "key": "INFOSEC" }, "Priority": { "name": "Medium" }, "Description": "description", "issuetype":{ "name": "Task" } } } ) });
Logger.log("Response code is %s", response.getResponseCode()); Logger.log(response.getContentText());}
Error: {"errorMessages":[],"errors":{"Priority":"Field 'Priority' cannot be set. It is not on the appropriate screen, or unknown.","Description":"Field 'Description' cannot be set. It is not on the appropriate screen, or unknown."}}
I have checked the screens and they are correctly configured and I have admin and developer access to all of them, so I assume it's an issue with my request.
Yes I think the "var data = ... " is in the correct format ... but you are posting a different payload where Priority and Description field id are capitalized.
Try with "payload": JSON.stringIfy( data )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.