Update an issue

I am trying to update an existing issue in our JIRA Cloud project. I am using the following C# code:

string newAssignee = "New Assignee";
string jsonString = @"{""fields"":""assignee"":""name"":" + "\"" + newAssignee + "\"";

TryJira.Jira objJira2 = new TryJira.Jira();
objJira2.JiraUrl = System.Configuration.ConfigurationManager.AppSettings["JiraUrl"];
objJira2.JiraJson = jsonString;
objJira2.JiraUserName = System.Configuration.ConfigurationManager.AppSettings["JiraUserName"];
objJira2.JiraPassword = System.Configuration.ConfigurationManager.AppSettings["JiraPassword"];
objJira2.addJiraIssue();
namespace RetrieveTasks
    {
public class Jira
        {
 public String addJiraIssue()
            {
            JiraService.open("PUT", JiraUrl + "/rest/api/2/issue/NPI-24");
            JiraService.setRequestHeader("Content-Type", "application/json");
            JiraService.setRequestHeader("Accept", "application/json");
            JiraService.setRequestHeader("X-Atlassian-Token", "nocheck");
            JiraService.setRequestHeader("Authorization", "Basic " + GetEncodedCredentials());
            JiraService.send(JiraJson);
            String response = JiraService.responseText;
            JiraService.abort();
            return response;
            }
}
}

When I check the “response” value it is a JSON-formatted retrieval of the entire project and the assignee hasn’t been changed. I don’t receive any errors.

The problem appears to be in the JSON string I am sending:

string jsonString = @"{""fields"":""assignee"":""name"":" + "\"" + newAssignee + "\"";

I changed the value to:

string jsonString = @"{""fields"":{""customfield_12302"":{""name"":""679""}}}";

Now I am getting the error “Operation value must be a string”

I’d suggest using a debugging proxy to check the actual contents of the HTTP request that you’re sending. Others have recommended RequestBin; I use Charles on Mac OS.

Just for the sake of clarity, are you still trying to set the assignee, or have you moved on to the problem of setting the value of a custom field?

I am only trying to resolve the error “Operation value must be a string”. I think if I could use Json.stringify it may resolve the issue, however for some reason I get “Json does not contain a definition for ‘stringify’”. I am using Json.NET.

The problem occurred because I did not have the correct URL for the PUT.