Hi Team,
while creating the issue through REST API, 'Team' field of JIRA Portfolio is not populating.I am trying to update Team with Custom ID: customfield_10300.your immediate help is highly appreciated
Thanks and Regards
Ramachandra Reddy
JIRA won't let you create a new field during an issue creation/update. Those fields have to exist in JIRA already before you can update a value for that field on that issue.
There is a way to create new custom fields via REST as per https://docs.atlassian.com/jira/REST/server/#api/2/field
Alternatively you can also create the custom field with that name in the JIRA GUI as explained in Adding a Custom Field. Please note that when you first create a custom field in JIRA, you will probably have to reindex JIRA in order to then be able to use that new custom field.
@G Ramachandra, can you show us the code you're using and the response from the server?
Hi @Steven F Behnke,
please find my code as below.
RestClient client = new RestClient("https://myproject.atlassian.net/rest/api/2");RestRequest request = new RestRequest("issue/", Method.POST);
client.Authenticator = new HttpBasicAuthenticator(txtJIRAUN.Text, txtJIRAUP.Text);
createIssue(request, client);
private void createIssue(RestRequest request, RestClient client){try{var issue = new Issue{fields =new Fields{description = JiraDesc,summary = _tfsTitle,project = new Project { key = "ProjectName" },issuetype = new IssueType { name = "IssueType" },priority = new Priority { name = _priority },customfield_10400 = _tfsID,customfield_11201 = _custName,customfield_11500 = _supportid,customfield_11100 = new Customfield_11100 { value = _itemType },customfield_10300 = "TestTeam",}};
request.RequestFormat = DataFormat.Json;request.AddJsonBody(issue);
var res = client.Execute<Issue>(request);if (res.StatusDescription == "Created"){_jiraKey = res.Data.key;bg.ReportProgress(0, "Issue Created, Id: " + _jiraKey);}else{bg.ReportProgress(0, "Issue Not Created.");}}catch (Exception ex){throw new Exception(ex.Message);}}
public class Issue{public string id { get; set; }public string key { get; set; }public Fields fields { get; set; }}
public class Fields{public Project project { get; set; }public IssueType issuetype { get; set; }public Priority priority { get; set; }public string summary { get; set; }public string description { get; set; }public string customfield_10400 { get; set; }public string customfield_11500 { get; set; }public string customfield_11201 { get; set; }public Customfield_11100 customfield_11100 { get; set; }public string customfield_10300 { get; set; }
}
public class Project{public string id { get; set; }public string key { get; set; }}public class IssueType{public string id { get; set; }public string name { get; set; }}public class Priority{public string id { get; set; }public string name { get; set; }}public class Customfield_11100{public string id { get; set; }public string value { get; set; }}
And Response from JIRA server as below
Okay, the error clearly states the problem.
Team with ID 'TestTeam' could not be found
Can you create an issue in JIRA with the Team field set to TestTeam and perform an HTTP GET on /rest/api/2/issue/issueKey so you know what you need to send to JIRA?
It looks like you're new here. Sign in or register to get started.