Skip to main content

How I can use a CSV file to upload different variables for a Box API call in Postman?

Hello,



Can I have more clarification on your question? Are you saying that you want to use a csv to update multiple objects (files, folders, users, etc) in Box in one call? Or are you saying, instead of typing information in the json body of the Postman window, you’d want to use a csv?



Thanks,


Alex, Box Developer Advocate


Hi,



Yes I want to use the collection runner in Postman in order to use CSV file that will update the path parameter, I am using the “https://{{api.box.com}}/2.0/folders/:folder_id/metadata/enterprise/securityClassification-6VMVochwUWo” API call and I want to use a CSV file to update the “:folder_id” using the collection runner in Postman.


Hello,



I have never used that functionality in Postman, so I can’t really speak to it.



However, you can use the Box CLI along the bulk commands feature to achieve the same thing. Its also probably easier with the CLI!



I highly recommend going through the CLI quick start.


Hi Alex,



I tries to use Box CLI but is doesn’t have bulk command for assigning “Classification” even as metadata, it only supports “Metadata Cascade Policies”., really appreciate if you can guide me how to do it in CLI. I agree with that CLI is easier.



Best Regards


Ah! I see. Let me investigate this a bit further and report back.


I have reached out to the CLI team to see about getting the classifications piece documented/supported.



In the meantime, let me work on a workaround for you.


It looks like you want to add specific metadata template to a folder. You can check the bulk operation of adding metadata to a folder:





maybe it will help you.


Thank you for sharing this command but unfortunately it only works on single folder, once I add the “–bulk-file-path”, I get the following error “I tired with 4 entries”.



"4 entries failed!



Entry 1 (


id=213735351436


) failed with error:


Metadata must be in the form key=value






Entry 2 (


id=213799010963


) failed with error:


Metadata must be in the form key=value






Entry 3 (


id=213555708197


) failed with error:


Metadata must be in the form key=value






Entry 4 (


id=213756339231


) failed with error:


Metadata must be in the form key=value



This is the command line that I am using


"box folders:metadata:add --bulk-file-path=C:\Users\asalama\Documents\Box\IDs.csv --template-key “securityClassification-6VMVochwUWo” --data “Box__Security__Classification__Key=Yellow Data”



This is Metadata for Classification.


Hi @user711 ,



When bulk command is executed, all params should be set in csv file. So please create the metadata.csv file based on this template:



Id,Scope,TemplateKey,Data

YOUR_FOLDER_ID_1,enterprise,securityClassification-6VMVochwUWo,Box__Security__Classification__Key=Yellow Data

YOUR_FOLDER_ID_2,enterprise,securityClassification-6VMVochwUWo,Box__Security__Classification__Key=Yellow Data

YOUR_FOLDER_ID_3,enterprise,securityClassification-6VMVochwUWo,Box__Security__Classification__Key=Yellow Data



Please replace YOUR_FOLDER_ID_X with the corresponding folder Ids.



Then run te following command:


box folders:metadata:add --bulk-file-path ./metadata.csv



Please let us know if it helped.


Yes I tried this last night and it worked, thank you.


Reply