/** * Sets a property. * * @param property the property * @param value the value * @return true, if successful */ public boolean setProperty(String property, String value) { APIrestful api = new APIrestful(); try { JSONObject jsonParam = new JSONObject(); jsonParam.put("value", value); if (api.put("system/" + currentID + "/property/" + property, jsonParam.toString())) { WriteResponse writeResponse = APIrestful.getGson().fromJson(api.getResult(), WriteResponse.class); if (writeResponse != null && (!writeResponse.getInsertKey().isEmpty() || writeResponse.getUpdateCount() > 0)) { return true; } } } catch (JSONException e) { new ErrorDialog(e, "Error encoding API request"); throw new RuntimeException("Error encoding API request"); } return false; }