新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

Assign Metadata Template created in admin console to files - Java SDK

回答済み
新規投稿

コメント

2件のコメント

  • Murtza

     Can you please share the error message that the API is returning along with the error code? 

    0
    コメントアクション パーマリンク
  • GiacomoZecchin

    I have resolved, thanks you the same 😃

     

    1) Create a MetadataTemplate from a copy based on a pre-existing schema (defined from admin console):

    FileReader reader = new FileReader("path/to/schema.json");

    JSONParser jsonParser = new JSONParser();
    JSONObject jsonObject = (JSONObject) jsonParser.parse(reader);

    // create MetadataTemplate based on JSON stringified
    MetadataTemplate imgTemplate = new MetadataTemplate(jsonObject.toJSONString());

     

    2) Create a NEW Metadata with the correct couple key:values (attention on types of key):

    Metadata metadata = new Metadata().add("/key1", "valu1").add("/key2", "value2");

     

    3) Assign template to file you want to with custom metadata

    //file.createMetadata(imgTemplate.getTemplateKey(), imgTemplate.getScope(), metadata); 

     

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。