Reputation: 11
I'm using below SDK to interact with JIRA via C#,
https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home
Ticket creation is successful and the response is shown in the console mentioning the ticket ID, but I cannot find a way to load the ticket ID to a variable.
var settings = new JiraRestClientSettings()
{
EnableRequestTrace = true
};
var jira = Jira.CreateRestClient("https://testjira.xxxxxxxx.com/",
jiraUsername, jiraPWD, settings);
var issue = jira.CreateIssue("TMS");
issue.Type = "Service Desk Incident";
issue.Summary = "Test issue created via API 3";
issue.Description = "Test issue created via API 3";
issue["Service Desk Priority"] = "Level 3";
await issue.SaveChangesAsync();
All I need to do is to capture this ID in a variable. Thanks in advance :)
Error message in the console when credentials are wrong
Upvotes: 1
Views: 963
Reputation: 2205
Looking at the source code in bitbucket, it can be seen that, it returns an Issue
object
public async Task<Issue> SaveChangesAsync(CancellationToken token = default(CancellationToken))
So, all you need is:
var jiraIssue = await issue.SaveChangesAsync();
jiraIssue.Key
is your newly created Key.
Upvotes: 2