Adding a User

Use this API to add a user to the eG manager.

Note:

A few key values of the Body parameter are optional. These optional key values are mentioned separately in the below table.

URL: http://<eG manager IP:port>/api/eg/orchestration/adduser

Method: POST

Content-Type: application/json

Inputs to be Specified
Parameters Key values Example

Headers

managerurl: Base URL of the eG Manager i.e., http://<IP address of the eG console:Port>

user: eG username or domain/eG username

pwd: Base64 encoded password

Example with Default key values:

{

"userid":"john",

"userrole":"monitor",

"password":"******",

"expirydate":"05/20/2021"

}

Example with both Default and Optional key values:

{

"userid":"john",

"userrole":"monitor",

"password":"******",

"expirydate":"05/20/2021",

"alarmsbymail":"critical,major",

"to":"saranya1@eginnovations.com",

"cc":"saran1@eginnovations.com,
9840391695",

"bcc":"shara@eginnovations.com"

}

Body

Default:

{

"userrole":"User role",

"userid":"User ID",

"password":"Password",

"expirydate":"MM/DD/YYYY"

}

Optional:

{

"alarmsbymail":"comma -separated list of Critical/Major
/Minor alarms (or) All",

"to":"comma-separated list
of Mail IDs/Mobile numbers",

"cc":"comma-separated list of Mail IDs/Mobile numbers",

"bcc":"comma-separated list of Mail IDs/Mobile numbers"

}

 

Success Response
Type Code Content

JSON

200

{

"Succeed": "User has been created successfully."

}

 

Failure Response
Type Code Content

JSON

401 UNAUTHORIZED

{

"Error": "Please provide a user role."

}

500 Server Error

{

"Error": "Please enter a valid date."

}

Figure 1 : Example to add a new user using Postman REST Client

Adding a User using cURL

To add a user through the REST API using cURL, specify the command in the following format:

curl --location --request POST "http://<eG Manager IP:Port>/api/eg/orchestration/adduser" -H "managerurl:http://<eG Manager IP:Port>"-H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "Content-Type: application/json" --data-raw "{'userrole': 'User role', 'userid': 'User ID', 'password': 'Password', 'expirydate': 'MM/DD/YYYY', 'alarmsbymail":"comma-separated list of Critical/Major/Minor alarms (or) All', 'to': 'comma-separated list
of Mail IDs/Mobile numbers', 'cc': 'comma-separated list of Mail IDs/Mobile numbers', 'bcc': 'comma-separated list of Mail IDs/Mobile numbers'}"

Note that the command specified above contains both the Default and Optional key values.

Figure 2 shows an example of adding a user using cURL.

Figure 2 : Adding a user using cURL