Hi
I try to add a new issue to JIRA. We installed the latest JIRA to our server and checked the API. We are able to authenticate, list issues, get one specific issue, delete issue… but when we try to create a new issue, we are still getting error: “Unsupported media type“ in the response. We used the example from the API documentation, it is basically 100% copy and we still face the problem. Any idea, is it somehow known to you?
He is the part of our code:
string issueToCreate = "{\"fields\":{\"project\":{\"key\":\"SIM\"},\"summary\":\"REST 1 merry gentlemen.\",\"description\":\"Creating of an issue using project keys and issue type names using the REST API\",\"issuetype\":{\"name\":\"Bug\"}}}"; RestClient client = new RestClient(); client.BaseUrl = "http://10.14.41.152:8076/rest/api/latest/"; client.Authenticator = new HttpBasicAuthenticator(username, password); // connection established RestRequest request = new RestRequest("issue", Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddBody(issueToCreate); request.RequestFormat = DataFormat.Json; IRestResponse response = client.Execute(request);
Thank you very much in advance!
Hi Michael,
"Unsupported media type" tipically occurs when the header "Content-Type: Application/json" was not present on the REST request. Can you make sure the "request.AddHeader" is being correctly parsed by your code?
I strongly suggest you to also test the request using Postman REST Client first, just to make sure JIRA is receiving the requests correctly.
Best regards,
Lucas Timm
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.