Skip to main content

Java sdk Classification


Forum|alt.badge.img

Hello,
I’m using the java sdk to add an enum option to the classification.
However, I can’t fill in the “classificationDefinition” and “colorID” arguments using the following code:

public JSONObject addEnumOption(String enumOptionKey, String key, String classificationDefinition, float colorID)
{
    JSONObject classificationObject = new JSONObject()
        .put("classificationDefinition", classificationDefinition)
        .put("colorID", colorID)
        .put("isTrialClassification", true);
    
    JSONObject staticConfigObject = new JSONObject()
        .put("classification", classificationObject);
    
    JSONObject dataObject = new JSONObject()
        .put("key", key)
        .put("staticConfig", staticConfigObject);
    
    JSONObject jsonObject = new JSONObject()
        .put("op", "addEnumOption")
        .put("fieldKey", "Box__Security__Classification__Key")
        .put("enumOptionKey", enumOptionKey)
        .put("data", dataObject);
    
    return jsonObject;        
}

            JSONObject jsonObject = new FieldOperation().addEnumOption("TEST","test","test",4);
            updates.add(new MetadataTemplate.FieldOperation(jsonObject.toString()));  
            return MetadataTemplate.updateMetadataTemplate(boxAPI.getAPI(), boxAPI.getScope(), Metadata.CLASSIFICATION_TEMPLATE_KEY, updates);

I’ve seen that it’s possible in our language like Node or curl. Do you know when this feature will be available for java?

thanks

2 replies

mcong Box
  • Participating Frequently
  • 8 replies
  • June 19, 2024

Hi @arthurS20

Thanks for your question, I created a PR, we will let you know when the new version of Box SDK released.

Best,
Minh


Forum|alt.badge.img
  • Author
  • New Participant
  • 2 replies
  • June 21, 2024

Hi @mcong ! Thx for you response

Do you know when the next release is scheduled ?


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings