If you’re looking into creating an issue, the proper REST API to use is POST /rest/api/3/issue. In your case, try changing the parameter in your URL constructor, to something like
URL jiraREST_URL = new URL("https://crgsolutions2.atlassian.net/rest/api/3/issue");
{"fields":{"CRGWebApplication":{"key":"CRGWEB-2"},"summary":"sum","description":"descr","issuetype":{"id":"10105"}}}/%7B%22fields%22%3A%7B%22CRGWebApplication%22%3A%7B%22key%22%3A%22CRGWEB-2%22%7D%2C%22summary%22%3A%22sum%22%2C%22description%22%3A%22descr%22%2C%22issuetype%22%3A%7B%22id%22%3A%2210105%22%7D%7D%7D
Server returned HTTP response code: 401 for URL: https://crgsolutions2.atlassian.net/rest/api/3/issue
Process finished with exit code 0
In my understanding of your code, getJSON_Body returns the above string. What is the field CRGWebApplication? Is it a custom field? Prior to creating an issue, kindly check the allowed fields for the project by calling Get create issue metadata. The basic project without modifications usually accepts the following request body at the bare minimum:
Stepping back a bit, since you’re getting a 401, this looks like an authorization problem. By any chance are you already using API tokens (are you just using CRGTOKEN as a substitute in this post)?
This is interesting. Before deep diving into the Java code, I suggest let’s isolate the issue that’s causing the 401. Can you do a successful cURL (or something like Postman if you prefer) call to /rest/api/3/myself using your email and API token? The request should look something like
@BasavarajaJuttiyavar let’s continue the discussion here. Can you respond to the question as to whether you were able to get a 200 OK response from https://crgsolutions2.atlassian.net/rest/api/3/myself using Postman?
I am pasting the link “https://crgsolutions2.atlassian.net/rest/api/3/myself” in Parms filed of post man and in Authorization filed i am selecting as Basic Auth and using jira cloud login name as username and password as token generated from the link: [Atlassian account ] in postman. But still i am getting 401 error i am not sure where i am missing!
{“fields”:{“CRGWebApplication”:{“key”:“CRGWEB-3”},“summary”:“sum”,“issuetype”:{“id”:“10000”}}}/%7B%22fields%22%3A%7B%22CRGWebApplication%22%3A%7B%22key%22%3A%22CRGWEB-3%22%7D%2C%22summary%22%3A%22sum%22%2C%22issuetype%22%3A%7B%22id%22%3A%2210000%22%7D%7D%7D
Looged in
Server returned HTTP response code: 400 for URL: https://crgsolutions10.atlassian.net/rest/api/3/issue
{“fields”:{“CRGWebApplication”:{“key”:“CRGWEB-3”},“summary”:“sum”,“issuetype”:{“id”:“10000”}}}/%7B%22fields%22%3A%7B%22CRGWebApplication%22%3A%7B%22key%22%3A%22CRGWEB-3%22%7D%2C%22summary%22%3A%22sum%22%2C%22issuetype%22%3A%7B%22id%22%3A%2210000%22%7D%7D%7D
Looged in
Server returned HTTP response code: 405 for URL: https://crgsolutions10.atlassian.net/rest/api/3/issue/CRGWEB-3