Creating multiple users with REST in CA Performance Management

book

Article ID: 124913

calendar_today

Updated On:

Products

CA Infrastructure Management CA Infrastructure Management CA Performance Management - Usage and Administration CA Performance Management - Data Polling

Issue/Introduction

When implementing a new environment there is often a need to create many new users.

An example of this effort might be migration from older eHealth installations, driving a need to duplicate users between environments.

How can the REST API be leveraged to create more than one new user account at a time?

Environment

All supported Performance Management releases.

Resolution

Current product REST capabilities are limited to creation of one user per REST call for user creation.

The best case for repetitive REST calls that can only be done one at a time is via scripting. The script calls curl statements for a set of values preset in a file used by the script.

A simple, and not syntactically correct, sample of what needs to be done is something like the following.
 
userNames=`cat /tmp/inputFile.txt` 

for i in $userNames; do 
curl --header "Content-Type: application/xml" --request PUT --data '<user><name>$i</name><description>$i</description><enabled>true</enabled><removable>true</removable><timezone>UTC</timezone><culture>en-US</culture></user>' --url http://$DAhostname:$port/rest/........ 

done; 
 
Where the inputFile has a username on each line. It can get as complex as scripting skills allow.