Problem creating an issue with REST API v3 (Error: Bad Request) in C#

Hi,
I’m new to Jira Word and I’m tring to create an issue with a C# program; my problem is that: when I run my program I receive the error 400 (Bad Request), I checked this community forum and the API documentation and it seems correct to me but the error is still present.

This is my code:

private HttpClient getClient()
{
HttpClient w_client = new();
w_client.BaseAddress = _jira_uri; // in format https://myTestSite.atlassian.net

byte[ ] authData = System.Text.Encoding.ASCII.GetBytes(_username+“:”+_apiKey); // _username is my email
string basicAuthentication = Convert.ToBase64String(authData);
w_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Basic”, basicAuthentication);
return w_client;
}

public string CreaTicket(string Pi_projectKey, string Pi_summary, string Pi_description)
{
try
{
HttpClient w_client = getClient();
w_client.DefaultRequestHeaders.Add(“ContentType”, “application/json”);
string data=
@“{ ““fields”” :
{ ““project”” : { ““key”” : “””+Pi_projectKey+ @“”“},
““issuetype””:{ ““id””:”“10004"”},
““summary”” : “”“+Pi_summary+@”“”,
““reporter””:{ ““id””:““5f3ecef6fcaf93003bc95ca6"”},
““description””:”“”+Pi_description+ @“”"
}
}";

        var result = w_client.PostAsync("/rest/api/3/issue", new StringContent(data, System.Text.Encoding.UTF8, "application/json"));
        result.Wait();
        if (result.Result.StatusCode != System.Net.HttpStatusCode.OK)
            throw new Exception( result.ToString());
        return result.ToString();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
        throw;
    }
}

Please can you help me on this issue?

Thanks,
Giuseppe.

Solved using Atlassian.SDK