Welcome to the new Box Support website. Check out all the details here on what’s changed.

How to associate Metadata to Document / folder using JDK API

Answered
New post

Comments

3 comments

  • Mitesh4Box

    Java docs API says to use followng method, I am trying to use the same getting 404 error. 

     

    Anyone tried this ?

     

    public Metadata createMetadata(String typeName, Metadata metadata)

    0
    Comment actions Permalink
  • kendomen

    I tried something simple and it seems to work.

     

    public static void main(String[] args) {
            BoxAPIConnection api = new BoxAPIConnection(DEVELOPER_TOKEN);
    
            BoxFile file = new BoxFile(api, "removed for privacy33");
            file.createMetadata(new Metadata().add("/foo", "bar"));
    
            Metadata metadata = file.getMetadata();
            System.out.println("printing out meta-data: " + metadata.get("/foo"));
    }

    Here's my output:


    printing out meta-data: bar

    Process finished with exit code 0

    0
    Comment actions Permalink
  • veemini

    Hi Kendomen,

      I created Metadata the same way you described, but while searching  for the key, I'm not getting any results. 

     

    Thanks,

    Veemini.

    0
    Comment actions Permalink

Please sign in to leave a comment.