code: public static MetadataTemplate createMetadataTemplate(BoxAPIConnection api, String scope, String templateKey,
              String displayName, boolean hidden, List<Field> fields) {
  
          JsonObject jsonObject = new JsonObject();
          jsonObject.add("scope", scope);
          jsonObject.add("displayName", displayName);
          jsonObject.add("hidden", hidden);
  
          if (templateKey != null) {
              jsonObject.add("templateKey", templateKey);
          }
  
          JsonArray fieldsArray = new JsonArray();
          if (fields != null && !fields.isEmpty()) {
              for (Field field : fields) {
                  JsonObject fieldObj = getFieldJsonObject(field);
  
                  fieldsArray.add(fieldObj);
              }
  
              jsonObject.add("fields", fieldsArray);
          }
  
          URL url = METADATA_TEMPLATE_SCHEMA_URL_TEMPLATE.build(api.getBaseURL());
          BoxJSONRequest request = new BoxJSONRequest(api, url, "POST");
          request.setBody(jsonObject.toString());
  
          BoxJSONResponse response = (BoxJSONResponse) request.send();
          JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
  
          return new MetadataTemplate(responseJSON);
      }
docs: Creates new metadata template.
  @param api the API connection to be used.
  @param scope the scope of the object.
  @param templateKey a unique identifier for the template.
  @param displayName the display name of the field.
  @param hidden whether this template is hidden in the UI.
  @param fields the ordered set of fields for the template
  @return the metadata template returned from the server.