curl -X POST https://language.googleapis.com/v1/documents:analyzeSyntax?key=[API KEY] -H "Content-Type: application/json" -d '{
"document":{ "type":"PLAIN_TEXT",
"content":"bob walks to the park"
},
"encodingType":"UTF8"
}'
ConnectionRequest req2=new ConnectionRequest();
req2.setUrl("https://language.googleapis.com/v1/documents:analyzeSyntax?key=[API KEY]");
req2.setPost(false);
req2.setHttpMethod("POST");
String JsonData = "{document:{ type:PLAIN_TEXT, content:bob walks to the park },encodingType:UTF8}";
req2.addArgument("Content-Type: application/json",JsonData.toString());
NetworkManager.getInstance().addToQueueAndWait(req2);
JSONParser parser = new JSONParser();
Map<String,Object> result = null;
try {
******* result = Rest.post("https://language.googleapis.com/v1/documents:analyzeSyntax?key=[API KEY]").jsonContent().body(JsonData).getAsJsonMap();
} catch (IOException e) {
e.printStackTrace();
System.out.println("fail");
}
Rest.
post("https://language.googleapis.com/v1/documents:analyzeSyntax?apiKey").
jsonContent().
body("place the JSON string of the request here").
fetchAsJsonMap(e -> {
Map<String, Object> m = e.getResultData();
// process response here...
});