Search code examples
c#redmine-api

How to get Redmine Rest Api Issue with any parameters?


I am getting Redmine Issue with parameters.

I tried:

var rmMan = new RedmineManager(RedmineHost, RedmineKey);
rmMan.GetObjectList<Issue>(new NameValueCollection { { "parent_id", "1111" } }).Where(i=>i.Tracker.Name == "MyTrackerName");

How can I overcome this?

I want to get "Issue" object, found in the parameters without specifying Id. For example on the tracker.


Solution

  • GetObjectList wont do any filtering unless you specify the parameters. It will get all objects of type Issue (in your case). Adding the Where clause does the filtering after you've selected everything. I'm not sure that your NameValueCollection using parent_id will do anything either and redmine-net-api has terrible documentation.

    Try this:

    var parameters = new NameValueCollection
    {
        { "parent_id", "1111" },
        { "tracker", "MyTrackerName" },
    }
    var rmMan = new RedmineManager(RedmineHost, RedmineKey);
    
    var issues = rmMan.GetObjectList<Issue>(parameters);
    

    Again, since the redmine-net-api documentation is very bad, this is kind of a shot in the dark.

    I've forked the repository on GitHub and I'm going to try to generate the XMLDoc comments for the library in the next few days. Hopefully it'll get released with the next version.