Loop through array in CLI

How can I use the sample SDK for adding a user (for example), and loop through it as an array.

Example:
[
{
"name": "TestUser Two",
"email": "test002@waynecorp.com",
"password": "TestUser123!"
},
{
"name": "TestUser Three",
"email": "test003@waynecorp.com",
"password": "TestUser123!"
},
{
"name": "TestUser Four",
"email": "test004@waynecorp.com",
"password": "TestUser123!"
}
]

In his day I also asked. And this was the answer.

"Your JSON is incorrect. The JSON has to mirror the public. The API takes one record at a time so you would need 2 files each with each file containing a single user record. In Linux, I could create the files and then do the following command to list each file in the directory and pipe them over to a gc command:

ls data/*.json | xargs -I{} gc users create -f {}

I am sure Powershell could do something similar."

Link: https://developer.mypurecloud.com/forum/t/fail-command-gc/10316/12

Regards,

1 Like

So, bulk import from the People page is still going to be the best bet there.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.