jonas0007 / Jira.SDK

SDK for Jira integration in .net
Apache License 2.0
32 stars 45 forks source link

Trouble creating new Issue #1

Closed tggm closed 9 years ago

tggm commented 9 years ago

Hello,

I'm having trouble creating a simple issue through the API.

The serialization (after calling JiraClient.AddIssue()) is throwing errors for every empty property in the issue. I'm trying something like:

       JiraClient jc = new JiraClient(JIRA_BASE_URL, JIRA_LOGIN,JIRA_PASSWORD);

        Issue newIssue = new Issue();
        newIssue.Fields = new IssueFields();
        newIssue.Subtasks = new List<Issue>();
        newIssue._comments = new List<Comment>();
        newIssue.Fields.TimeTracking = new TimeTracking();
        newIssue.Description = "asdf";
        newIssue.Summary = "asdf";
        newIssue.Fields.Project = targetProject;  // Project instance.

        jc.AddIssue(newIssue);  // Still a lot of Fields to initialize 

Still a lot of fields to populate by the looks of it.... Is there a better way? What would be the minimum ammount of fields we have to populate for AddIssue ()'s serialization to work.?

jonas0007 commented 9 years ago

Hi @tggm ,

Currently I'm using my SDK for getting things out of Jira so appart from adding comments and doing transitions, there aren't any actions implemented which store data in Jira.

Feel free to create a pull request though :). Here is the link for the Jira REST api documentation: https://docs.atlassian.com/jira/REST/latest/#d2e2786

The main issue with the REST API is that the POST services don't accept the same objects as we get returned by the GET functions.

The quickest way of implementing such a method would be to create a method in the JiraClient which serializes an issue object into the correct format like I did when transitioning an issue.