code: public JSONObject saveRule(String objectID, JSONObject rule, boolean forwardToReplicas, RequestOptions requestOptions) throws AlgoliaException {
      try {
        return client.putRequest("/1/indexes/" + encodedIndexName + "/rules/" + URLEncoder.encode(objectID, "UTF-8") + "?forwardToReplicas=" + forwardToReplicas, rule.toString(), requestOptions);
      } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
      }
    }
docs: Save a query rule
  
  @param objectID          the objectId of the query rule to save
  @param rule              the content of this query rule
  @param forwardToReplicas Forward this operation to the replica indices
  @param requestOptions    Options to pass to this request