Difference between revisions of "Template:TalkToUpdox - Java"
From Updox API
(Created page with " ObjectMapper mapper = new ObjectMapper(); Map<String,Object> messageData = BuildMessage(); String jsonData = mapper.writeValueAsString(messageData); ...") |
|||
Line 3: | Line 3: | ||
String jsonData = mapper.writeValueAsString(messageData); | String jsonData = mapper.writeValueAsString(messageData); | ||
HttpResponse httpResponse = SendReceiveJSON(jsonData, uri); | HttpResponse httpResponse = SendReceiveJSON(jsonData, uri); | ||
− | + | ||
HttpEntity responseEntity = httpResponse.getEntity(); | HttpEntity responseEntity = httpResponse.getEntity(); | ||
String response = EntityUtils.toString(responseEntity); | String response = EntityUtils.toString(responseEntity); | ||
JsonNode actualObj = mapper.readTree(response); | JsonNode actualObj = mapper.readTree(response); | ||
− | + | ||
System.out.println(actualObj.get("responseCode")); | System.out.println(actualObj.get("responseCode")); | ||
System.out.println(actualObj.get("responseMessage")); | System.out.println(actualObj.get("responseMessage")); |
Revision as of 18:36, 19 November 2013
ObjectMapper mapper = new ObjectMapper(); Map<String,Object> messageData = BuildMessage(); String jsonData = mapper.writeValueAsString(messageData); HttpResponse httpResponse = SendReceiveJSON(jsonData, uri); HttpEntity responseEntity = httpResponse.getEntity(); String response = EntityUtils.toString(responseEntity); JsonNode actualObj = mapper.readTree(response); System.out.println(actualObj.get("responseCode")); System.out.println(actualObj.get("responseMessage"));