redmine-net-api icon indicating copy to clipboard operation
redmine-net-api copied to clipboard

Cant create new issue

Open sakonja opened this issue 5 years ago • 8 comments

Hi

I have a problem which for now i dont know how to solve. Couple of days ago we swithced to new redmine an from that day redmine .net api stopped working partialy. Strage thing it is working when gettng issues, custom fields, projects but every POST method is not working and i don't get even error message, it feels like everything is ok but issue is not created. When trying from boomerang rest service i can create issue, but from .net cant and i dont know why. Here is my example:

var manager = new RedmineManager(Redminehost, RedmineUserApiKey, RedmineAdminApiKey);

var newIssue = new Issue { Subject = strSubject, Description = command, Project = new IdentifiableName { Id = Convert.ToInt32(idProjekta) }, CustomFields = customFieldValues };

manager.CreateObject(newIssue);

sakonja avatar Apr 03 '20 13:04 sakonja

Hi any update on that?

I tried with new version of dll but still no response when doing POST only get is working, This is what i tried in little test project.

`var idProjekta = "1"; var command = ""parcel":"123"\r\n\r\ntest"; var strSubject = "test";

        List<IssueCustomField> customFieldValues = new List<IssueCustomField>();
         customFieldValues.Add(new IssueCustomField() { Name= "ccEmail", Values = new CustomFieldValue[] { new CustomFieldValue() { Info = "[email protected]" } } });
         customFieldValues.Add(new IssueCustomField() { Name = "ccCompanyName", Values = new CustomFieldValue[] { new CustomFieldValue() { Info = "Service" } } });
        customFieldValues.Add(new IssueCustomField() { Name = "ccFullName", Values = new CustomFieldValue[] { new CustomFieldValue() { Info = "goga" } } });

string Redminehost = dtRedmineInit.Rows[0]["RedmineHost"].ToString(); string RedmineUserApiKey = dtRedmineInit.Rows[0]["RedmineUserApiKey"].ToString().Trim(); string RedmineAdminApiKey = dtRedmineInit.Rows[0]["RedmineAdminApiKey"].ToString().Trim();

            var manager = new RedmineManager(Redminehost, RedmineUserApiKey, RedmineAdminApiKey);`

Maybe i am missing something, i cant set id of custom value anymore, maybe that is preventing saving of the issue.

sakonja avatar May 13 '20 13:05 sakonja

Hi, If you are using the latest version (4.0) the following should work:

 var  icf = IdentifiableName.Create<IssueCustomField>(NEW_ISSUE_CUSTOM_FIELD_ID);
 icf.Values = new List<CustomFieldValue> {new CustomFieldValue {Info = "[email protected]"}};
 
var issue = new Issue
{
     Project = IdentifiableName.Create<IdentifiableName>(idProjekta),
     Subject = strSubject,
     Description = command,
     CustomFields = new List<IssueCustomField> {icf},
};

var savedIssue = redmineManager.CreateObject(issue);

zapadi avatar May 13 '20 13:05 zapadi

Thank you for comment. I tried that code but i am always getting 502 Bad gateway error. What can be reason for that, did somebody ecountered something like that? Every get is okay but every post even when i remove custom fields and try to enter just one issue is bad gateway, status description is Proxy error

sakonja avatar May 13 '20 19:05 sakonja

Hi, any updates on this?

I have the same problem. I am using Redmine version 4.1.1 and the latest dll version (4.2.0). This is what I have tried:

var manager = new RedmineManager(host, apiKey);

        Issue issue = new Issue();
        issue.Project = IdentifiableName.Create<IdentifiableName>(<project_id>);
        issue.Priority = IdentifiableName.Create<IdentifiableName>(<priority_id>);
        issue.Subject = "Example";
        issue.Description = "Description";
        issue.Status = IdentifiableName.Create<IdentifiableName>(<status_id>);
        issue.AssignedTo = IdentifiableName.Create<IdentifiableName>(<assigned_to_id>);
        issue.Tracker = IdentifiableName.Create<IdentifiableName>(<tracker_id>);

        Issue savedIssue = manager.CreateObject(issue);

I am always getting 502 Bad gateway error.

I will be grateful for any hints.

12345adam12345 avatar Nov 23 '20 07:11 12345adam12345

I seem to have pretty much this exact same problem and situation.

We recently updated our Redmine from version 3.4.4.stable to 4.2.0.stable and I am using version 4.2.0 of the redmine-api library.

I seem to have no problems whatsoever with getting all issues, but whenever I create a TimeEntry instead of creating that TimeEntry and returning the created TimeEntry, it doesn't create the TimeEntry and returns an entirely different existing TimeEntry. There are no Exceptions or any other errors as far as I can tell.

This is the code in question I am using to create the TimeEntry, which is unchanged from before the update, the only thing that has changed is the Redmine version. Any ideas as to what is causing this problem?

                RedmineHelper.GetAllIssues().TryGetValue(comboBoxStopwatchIssue.SelectedItem.ToString(), out Issue issueSelected);
                RedmineHelper.GetAllActivities().TryGetValue(comboBoxActiviteit.SelectedItem.ToString(), out TimeEntryActivity entryActivity);

                decimal.TryParse(timer.TotalHours.ToString(), out decimal totalTimeSpent);

                Redmine._rm.CreateObject<TimeEntry>(new TimeEntry()
                {
                    Issue = IdentifiableName.Create<IdentifiableName>(issueSelected.Id),
                    Hours = totalTimeSpent,
                    Comments = textBoxCommentaar.Text.ToString(),
                    Activity = IdentifiableName.Create<IdentifiableName>(entryActivity.Id)
                });

KoertLichtendonk avatar Apr 09 '21 07:04 KoertLichtendonk

I have no idea, but I'll do my best to find out.

zapadi avatar Apr 09 '21 07:04 zapadi

I can report the same Problem We recently updated to version 4.2.3.stable.21244. REST API is enabled. Every other request works but neither the Json or XML post request to create an issue works. I even tried it in Postman.

ghost avatar Dec 04 '21 10:12 ghost

I can report the same Problem We recently updated to version 4.2.3.stable.21244. REST API is enabled. Every other request works but neither the Json or XML post request to create an issue works. I even tried it in Postman.

Found the problem for me. Had http in my host string but the Redmine server was running on https

ghost avatar Dec 04 '21 10:12 ghost