@RequestBody String body) throws JSONException, UnsupportedEncodingException {
MetaGraphTx tx = metaGraphService.newTransaction();
try {
BranchMetadata branchMetadata = tx.getBranch(branchId);
if (branchMetadata == null) {
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentType(MediaType.APPLICATION_JSON);
JSONObject json = new JSONObject();
json.put("status", "error");
json.put("msg", "unknown branch '" + branchId + "'");
return new ResponseEntity<>(json.toString(), responseHeaders, HttpStatus.BAD_REQUEST);
}
GraphMetadata graphMetadata = branchMetadata.getGraph();
if (graphMetadata == null) {
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentType(MediaType.APPLICATION_JSON);
JSONObject json = new JSONObject();