Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using REST API create issue, why is issue results fields returning null?

 

Using REST API I am creating a new issue and using the response content to gather certain fields including 'asignee' and 'workflow'(status name)

The problem I am having is that fields is retunring null via the code below:

public async Task<List<IssueResult>> CreateIssuesAsync(IssueUpdate issueUpdate)
{
JsonSerializerSettings setting = new JsonSerializerSettings();
setting.ContractResolver = new ContractResolver();

string json = JsonConvert.SerializeObject(issueUpdate, setting);
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await HttpClient.PostAsync(createIssuesUrl, content);
var responseContent = response.Content.ReadAsStringAsync();
IssueCreationResponse creation = JsonConvert.DeserializeObject<IssueCreationResponse>(responseContent.Result);
return creation.IssueResults;
}

public class IssueResult
{
[JsonProperty(PropertyName = "id")] public string Id { get; set; } [JsonProperty(PropertyName = "key")] public string Key { get; set; } [JsonProperty(PropertyName = "self")] public string Link { get; set; } [JsonProperty(PropertyName = "fields")] public Fields Fields { get; set; } } public class Fields {
[JsonProperty(PropertyName = "asignee")] public string Assignee { get; set; } [JsonProperty(PropertyName = "status")] public Status Status { get; set; } } public class Status {
[JsonProperty(PropertyName = "name")] public string Name { get; set; } }

The issue is being created correctly, and properly retrieveing return values for 'id', 'key', and 'self'.

 

1 answer

To answer my own question, it appears that creation response only retunrs id, key, and self. Therefore another query must be used to retrieve the required content.

Thanks.  This hit me too.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you