Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Create Metadata Templates with Box CLI

New post

Comments

2 comments

  • mbehn-box

    Hi ,

     

    Thank you for your question and we appreciate your feedback on the CLI documentation. We are always working to improve our documentation and will take your notes into consideration for future enhancements.

     

    After some testing, I was able to accomplish this using  json. This is what the command looks like without a json file:

     

    box metadata-templates:create --display-name="My new template's display name" --multi-select=some_multi_select_field_name option="option1" option="option2"

     

    We create the template and assigning a multi select field. The two option parameters will be applied to multi-select-field. We will remove some of these parameters to add the to the json file which will also allow us to create multiple mulitSelect fields with multiple options at once.

     

    Here is the command with JSON.

     

    box metadata-templates:create --bulk-file-path=path_to.json

     

    The JSON File is an array of objects each represent a template to process. We can include the template name here as well. This example creates two templates with multiple multiSelect inputs with 3 options each. The multi select options are set as an array assigned to "multi-select". Because we want to create multiple multiSelects, we will pass an array of these kinds of objects to a top level "multi-select"

     

    [
        {
            "display-name": "Test Display Name 123",
            "multi-select": [
                {
                    "multi-select": "Test multi select 1",
                    "option": ["option1","option2","option3"]
                },
                {
                    "multi-select": "Test multi select 2",
                    "option": ["option1","option2","option3"]
                }
            ]
        },
        {
            "display-name": "Test Display Name 456",
            "multi-select": [
                {
                    "multi-select": "Test multi select 1",
                    "option": ["option1","option2","option3"]
                },
                {
                    "multi-select": "Test multi select 2",
                    "option": ["option1","option2","option3"]
                }
            ]
        }
    ]

     

     

    Hopefully this gets you what you need!

    0
    Comment actions Permalink
  • ianhorn17

    What would a CSV look like for the --bulk-file-path?

    1
    Comment actions Permalink

Post is closed for comments.