'Calling API with JSON format gives the unknown format error
I am calling an API with groovy code with Jason format data and the response we receive "Response code was 500" "��VJ-�/�M-.NLO-V��V��+I-�K�Q(N-K-R+P�Ձ�*������J7" Please help if anybody has faced the same issue.
enter image description here [enter image description here][2]
def payloadMap = ["project":["id":"12412"], "summary": "Test ticket for testing API 4", "assignee": ["name": "in22915194"], ] def payloadData = JsonOutput.toJson(payloadMap)
def url = new URL(uri);
// NOTE: The following removes all checks against SSL certificates
disableSSL();
def conn = url.openConnection(proxy);
conn.doOutput = true;
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
writer.write(payloadData.toString().trim());
writer.flush();
writer.close();
InputStream responseStream = conn.getInputStream();
result = responseStream.getText();
responseStream.close();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
