use of kong.unirest.json.JSONObject in project zeppelin by apache.
the class ZeppelinClient method addParagraph.
/**
* Add paragraph to note with provided title and text.
*
* @param noteId
* @param title
* @param text
* @return
* @throws Exception
*/
public String addParagraph(String noteId, String title, String text) throws Exception {
JSONObject bodyObject = new JSONObject();
bodyObject.put("title", title);
bodyObject.put("text", text);
HttpResponse<JsonNode> response = Unirest.post("/notebook/{noteId}/paragraph").routeParam("noteId", noteId).body(bodyObject.toString()).asJson();
checkResponse(response);
JsonNode jsonNode = response.getBody();
checkJsonNodeStatus(jsonNode);
return jsonNode.getObject().getString("body");
}
use of kong.unirest.json.JSONObject in project zeppelin by apache.
the class ZeppelinClient method stopInterpreter.
/**
* This is equal to the restart operation in note page.
*
* @param noteId
* @param interpreter
*/
public void stopInterpreter(String noteId, String interpreter) throws Exception {
JSONObject bodyObject = new JSONObject();
bodyObject.put("noteId", noteId);
HttpResponse<JsonNode> response = Unirest.put("/interpreter/setting/restart/{interpreter}").routeParam("interpreter", interpreter).body(bodyObject.toString()).asJson();
checkResponse(response);
JsonNode jsonNode = response.getBody();
checkJsonNodeStatus(jsonNode);
}
use of kong.unirest.json.JSONObject in project zeppelin by apache.
the class ZeppelinClient method renameNote.
public void renameNote(String noteId, String newNotePath) throws Exception {
JSONObject bodyObject = new JSONObject();
bodyObject.put("name", newNotePath);
HttpResponse<JsonNode> response = Unirest.put("/notebook/{noteId}/rename").routeParam("noteId", noteId).body(bodyObject.toString()).asJson();
checkResponse(response);
JsonNode jsonNode = response.getBody();
checkJsonNodeStatus(jsonNode);
}
Aggregations