公式のAPIリファレンスを探しましたが見つからずあきらめて、ググったらCommunityに近い投稿がありました。
https://community.atlassian.com/t5/Jira-questions/Trying-to-set-people-custom-field-via-JIRA-REST-API/qaq-p/461310
これでできました
customfield_10026: { "name": "Email" },
コード.gs
var JIRA_ISSUE_URL = 'https://NAME.atlassian.net/rest/api/2/issue/'; function postIssue() { var token = get_token(); var payload = get_payload(); var options = get_options(token, payload); var response = UrlFetchApp.fetch(JIRA_ISSUE_URL, options); Logger.log(response); } function get_payload(values) { var email = Session.getActiveUser().getEmail(); var data = { project: {key: "KEY"}, issuetype: {name: "Task"}, priority: {name: 'Medium'}, summary: "たいとる", description: "タスクの説明です\n説明の2行め", customfield_10026: { "name": "admin" }, reporter: {id: "accountId"} }; var fields = {fields: data}; var payload = JSON.stringify(fields); return payload; } function get_options(token, payload) { var options = { method: "post", payload: payload, contentType: "application/json", headers: {"Authorization": " Basic " + token} } return options; } function get_token() { var id = "Email"; var api_token = "API TOKEN"; var token = Utilities.base64Encode(id + ":" + api_token); return token; } |
参考
Community
https://community.atlassian.com/t5/Jira-questions/Trying-to-set-people-custom-field-via-JIRA-REST-API/qaq-p/461310
公式リファレンス
https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2