Cleanup your Zendesk organizations by removing all users with a non-matching email domain, or by adding users with a matching domain.
This app is a showcase from the article Cleaning up Zendesk Organisations with a sidebar app
Note: To protect the data in your Zendesk account, bulk user imports are not enabled by default in Zendesk accounts. The account owner must contact Zendesk Customer Support to enable the imports. A 403 Forbidden error is returned if data imports are not enabled.
curl --location 'https://{subdomain}.zendesk.com/api/v2/users/create_or_update_many' \
--header 'Authorization: Basic {Base64(username:token)}' \
--header 'Content-Type: application/json' \
--data-raw '{"users":[
{"name":"Iron Man","email":"[email protected]","tags":["org_demo"]},
{"name":"Captain America","email":"[email protected]","tags":["org_demo"]},
{"name":"The Hulk","email":"[email protected]","tags":["org_demo"]},
{"name":"Spider-Man","email":"[email protected]","tags":["org_demo"]},
{"name":"Black Panther","email":"[email protected]","tags":["org_demo"]},
{"name":"Winter Soldier","email":"[email protected]","tags":["org_demo"]}
]}'
curl --location 'https://{subdomain}.zendesk.com/api/v2/users/create_or_update_many' \
--header 'Authorization: Basic {Base64(username:token)}' \
--header 'Content-Type: application/json' \
--data-raw '{"users":[
{"name":"Sleepy","email":"[email protected]","tags":["org_demo"]},
{"name":"Dopey","email":"[email protected]","tags":["org_demo"]},
{"name":"Doc","email":"[email protected]","tags":["org_demo"]},
{"name":"Happy","email":"[email protected]","tags":["org_demo"]},
{"name":"Sneezy","email":"[email protected]","tags":["org_demo"]},
{"name":"Grumpy","email":"[email protected]","tags":["org_demo"]},
{"name":"Bashful","email":"[email protected]","tags":["org_demo"]}
]}'