Just to add more information :
The following command is working fine : .\btapi.exe --verbose --env-file .\env-file.txt --input-json --input .\vaultGroups.json add vault/account-group
with the following json file :
{
"name": "VaultGroup",
"description": "This is my test Vault Group"
}
However if I want to add several VaultGroup in one shot it is not working anymore with the following syntax :
>
{
"name": "VaultGroup1",
"description": "This is my test Vault Group 1"
},
{
"name": "VaultGroup2",
"description": "This is my test Vault Group 2"
},
{
"name": "VaultGroup3",
"description": "This is my test Vault Group 3"
}
]
I have this output in verbose :
Config loaded (from environment), using BT_API_HOST=i], version=Ov1] Parsing path .\env-file.txt] Loading env from C:\Users\W10LAB\Desktop\Unicancer\btapi\env-file.txt]
Config loaded (from file), using BT_API_HOST=access.unicancer.fr], version=v1]
Loading input file .\vaultGroups.json
Parsing path .\vaultGroups.json]
add vault/account-group Read input data
{
"name": "VaultGroup1",
"description": "This is my test Vault Group 1"
},
{
"name": "VaultGroup2",
"description": "This is my test Vault Group 2"
},
{
"name": "VaultGroup3",
"description": "This is my test Vault Group 3"
}
]
{'name': 'VaultGroup1', 'description': 'This is my test Vault Group 1'},
{'name': 'VaultGroup2', 'description': 'This is my test Vault Group 2'},
{'name': 'VaultGroup3', 'description': 'This is my test Vault Group 3'}
]
Unexpected input parameters: 0, 1, 2
Hello Fabien Landais,
Just looking through your API string, and some other API documentation, it could be possible the API only supports adding a single entry at a time, and you would need to use a do...while or for… program loop through the JSON file one entry at a time, running the BTAPI Command to add once per new Vault Group you wish to create.
This also seems to be the case as per your exmaple where a json with a single new entry works as expected. The JSON can contain many ther properties then just the name and descrption, hence the use of that format, I suspect.
Hi PhilC,
Thank you for your answer even if it’s not the exact one I would like to hear
Normally this kind of feature is really valuable to do mass import so if it’s not usable like that it’s a shame
Hello Fabien Landais - you absloutely can use the API for Mass Imports, you just have to loop through a list within your code, from what I can see.