Project

General

Profile

[.Net Core API]Error update object in redmine

Added by Quang Qui Bui over 6 years ago

i using .net core api to building for my project. i updated a issue object as folows:

public bool UpdateAssignedToOfIssues(string issueId, string account)
        {
            try
            {
                var issue = manager.GetObject<Issue>(issueId, null);
                int userId = _userService.GetIdByLoginName(account);
                if (userId > 0)
                {
                    IdentifiableName identifiableName = new IdentifiableName()
                    {
                        Id = userId,
                        Name = _userService.GetFullNameById(userId.ToString()),

                    };
                    issue.AssignedTo = identifiableName;
                    //issue.Description = "ADP next to update description";
                    manager.UpdateObject(issueId, issue);
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                return false;
            }
        }

I get an exception:
{Redmine.Net.Api.Exceptions.RedmineException: UpdateObject has invalid or missing attribute parameters: Assignee is invalid
 ---> System.Net.WebException: The remote server returned an error: (422) Unprocessable Entity .

When i tried update "Description" properties and it's worked!i enabled rest webservice and JSONP support.
Help for me please!

log.txt (1.71 KB) log.txt