Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  Loop through array in CLI

    Posted 06-05-2025 18:19

    Mark_Rynard | 2021-03-25 19:07:52 UTC | #1

    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!" } ]


    kike_zelenza | 2021-03-26 12:44:41 UTC | #2

    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,


    Mark_Rynard | 2021-03-26 14:23:48 UTC | #3

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


    system | 2021-04-25 14:23:51 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 10416