It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I send solicitus Post in Jira, it always returns 400 error

I try to send data with POST method to JIRA, but I get Error 400 in the UploadString () method.

The token is correct and the Json and tested in POSTMAN is OK, which is the problem?

I've been with this for several days and I can not solve it, could someone be kind enough to help me? Thank you

string json = @"{
                     'fields': {
                            'project': {
                                'key': 'EXAMPLE',
                                'projectTypeKey': 'service_exam'
                            'customfield_11283': {
                                'self': '',
                                'value': 'HELLO',
                                'id': '14538'
                            'issuetype': {
                                'self': '',
                                'id': '11835',
                                'description': '',
                                'name': 'EXTac',
                                'subtask': false
                            'summary': '-',
                            'customfield_10300': {
                                                'requestType': {
                                                    '_expands': [
                                                    'id': '119',
                                                    '_links': {
                                                        'self': ''
                                                    'name': 'ExmTick 40517',
                                                    'description': 'Register Peter Parker',
                                                    'helpText': '

                                                    'groupIds': [ '24' ]

And mi code with the credentials in ATLASSIAN JIRA and the request is:

string jsonResponse = string.Empty;
    var userid = "";
    var password = "QLodasdTCdt7Exampledsfsdf"; //no is real is example
    var endpoint = ""; //no is real is example
    using (var client = new WebClient())
        {            client.Encoding = Encoding.UTF8;            client.Headers.Set("Authorization", "Basic " + GetEncodedCredentials(userid, password));            client.Headers.Add("Content-Type: application/json");            client.Headers.Add("Accept", "application/json");
            var uri = new Uri(endpoint);
            var response = client.UploadString(uri, "POST", json);            jsonResponse = response;
        catch (WebException ex)
            if (ex.Status == WebExceptionStatus.ProtocolError)
                HttpWebResponse wrsp = (HttpWebResponse)ex.Response;
                var statusCode = (int)wrsp.StatusCode;
                var msg = wrsp.StatusDescription;
                throw new HttpException(statusCode, msg);
                throw new HttpException(500, ex.Message);
    return jsonResponse;

And the method for convert in UTF8 is:

private static string GetEncodedCredentials(string userid, string password)
        string mergedCredentials = string.Format("{0}:{1}", userid, password);
        byte[] byteCredentials = UTF8Encoding.UTF8.GetBytes(mergedCredentials);
        return Convert.ToBase64String(byteCredentials);


1 answer

sorry, some administrator can move it to JIRA

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Hipchat

Hipchat Cloud and Stride have reached End of Life (updated)

All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us.  As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...

35,207 views 9 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you