@SuppressWarnings("unchecked")
  public Map<ProjectVersionRef, String> translateVersions(List<ProjectVersionRef> projects) {
    // Execute request to get translated versions
    HttpResponse<Map> r;
    try {
      r =
          Unirest.post(this.endpointUrl)
              .header("accept", "application/json")
              .header("Content-Type", "application/json")
              .body(projects)
              .asObject(Map.class);
    } catch (UnirestException e) {
      throw new RestException(
          String.format(
              "Request to server '%s' failed. Exception message: %s",
              this.endpointUrl, e.getMessage()));
    }

    // Handle some corner cases (5xx, 4xx)
    if (r.getStatus() / 100 == 5) {
      throw new ServerException(
          String.format(
              "Server at '%s' failed to translate versions. HTTP status code %s.",
              this.endpointUrl, r.getStatus()));
    } else if (r.getStatus() / 100 == 4) {
      throw new ClientException(
          String.format(
              "Server at '%s' could not translate versions. HTTP status code %s.",
              this.endpointUrl, r.getStatus()));
    }

    return r.getBody();
  }
 public static MktmpioInstance create(
     final String urlRoot,
     final String token,
     final String dbType,
     final boolean shutdownWithBuild)
     throws IOException, InterruptedException {
   final String url = urlRoot + "/api/v1/new/" + dbType;
   HttpResponse<JsonNode> json;
   try {
     json =
         Unirest.post(url)
             .header("accept", "application/json")
             .header("X-Auth-Token", token)
             .asJson();
   } catch (UnirestException ex) {
     System.err.println("Error creating instance:" + ex.getMessage());
     throw new IOException(ex.getMessage(), ex);
   }
   if (json.getStatus() >= 400) {
     String message = json.getBody().getObject().optString("error", json.getStatusText());
     System.err.println("Used token: " + token);
     System.err.println("error response: " + json.getStatusText());
     System.err.println("response body: " + json.getBody().toString());
     throw new IOException("Error creating " + dbType + " instance, " + message);
   }
   JSONObject res = json.getBody().getObject();
   String id = res.getString("id");
   String host = res.getString("host");
   int port = res.getInt("port");
   String username = res.optString("username", "");
   String password = res.optString("password", "");
   final MktmpioEnvironment env =
       new MktmpioEnvironment(
           token, id, host, port, username, password, dbType, shutdownWithBuild);
   return new MktmpioInstance(env);
 }