When I try to create an issue
issueClient.createIssue(newIssue.build()).claim().getKey();
I get
org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character
How can I deal with that?
The error seems to be clear. You are sending a wrong data object to that API. The JSON object isn't formatted properly. You need to get that checked.
I send via postaman:
and as IssueInput I get:
IssueInput{fields={summary=FieldInput{id=summary, value=REST ye merry gentlemen.}, issuetype=FieldInput{id=issuetype, value=ComplexIssueInputFieldValue{valuesMap={id=1}}}, project=FieldInput{id=project, value=ComplexIssueInputFieldValue{valuesMap={key=TEST}}}}}
when I execute
issueClient.createIssue(input).claim().getKey();
I get:
org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 1 of <?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: https://ocadotech.atlassian.net/rest/api/3/rest/api/latest/issue</message></status>
I do think I have correct json, but if I'm wrong please correct me.
Your JSON data seems valid, I'm not sure what might be wrong here. If you're sending via postman probably you want to confirm that the URL you're sending to is actually the right one and also if there's any additional data that is being passed along with your request via the postman.
I solved the issue using the feign client.
It looks like you're new here. Sign in or register to get started.