Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant create new issue #256

Open
sakonja opened this issue Apr 3, 2020 · 8 comments
Open

Cant create new issue #256

sakonja opened this issue Apr 3, 2020 · 8 comments
Assignees

Comments

@sakonja
Copy link

sakonja commented Apr 3, 2020

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);

@zapadi zapadi self-assigned this Apr 5, 2020
@sakonja
Copy link
Author

sakonja commented May 13, 2020

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 = "go@something.hr" } } });
         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.

@zapadi
Copy link
Owner

zapadi commented May 13, 2020

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 = "go@something.hr"}};
 
var issue = new Issue
{
     Project = IdentifiableName.Create<IdentifiableName>(idProjekta),
     Subject = strSubject,
     Description = command,
     CustomFields = new List<IssueCustomField> {icf},
};

var savedIssue = redmineManager.CreateObject(issue);

@sakonja
Copy link
Author

sakonja commented May 13, 2020

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

@12345adam12345
Copy link

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.

@KoertLichtendonk
Copy link

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)
                });

@zapadi
Copy link
Owner

zapadi commented Apr 9, 2021

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

@ghost
Copy link

ghost commented Dec 4, 2021

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
Copy link

ghost commented Dec 4, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants