Adding External Agents in Bulk

The CSV file created specifically for adding multiple remote agents to the eG Enterprise system, should contain the following entries:

Element,action
ExternalAgent,add
Hostip/hostname,agentname
Details of extenalagent1>
<Details of extenalagent2>
<Details of extenalagent3>
.
.
.

For instance:

Element,action
ExternalAgent,add
hostip,agentname
192.168.10.8,ext8
192.168.10.10,ext10
192.168.10.12,lin12

If you use the host name instead of hostip, then your specification should be:

Element,action
ExternalAgent,add
hostname,agentname
egurkha25,ext8
egurkha26,ext10
egurkha27,lin12

Note that the column names (hostip,hostname,etc.) used in the CSV file are the same as the input parameters of the ‘addexternalagent’ command supported by the eG REST API.

If the eG license enables the client emulation capability, then the CSV file should include an additional clientemulation column. Therefore, if you want to add two external agents - one to be used for client emulation and another that is not used for client emulation - then, your CSV specification should be as follows:

Element,action
ExternalAgent,add
hostip,agentname,clientemulation
192.168.10.8,ext8,yes
192.168.10.10,ext10,no

Once the CSV file (let's say, the name of the file is addextagent.csv) is created on the eG manager, invoke the URL command mentioned in the below table from the eG REST API Client to update the eG manager with all the modifications contained in the CSV file.

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

Method: POST

Content-Type: multipart/form-data

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

{

"file": G:\addextagent.csv

}

Body

Default:

{

"file" : "Full path to the CSV file"

}

 

 

Success Response
Type Code Content

JSON

200

{

"Succeed": "External agent has been added successfully."

}

 

Failure Response
Type Code Content

JSON

401 UNAUTHORIZED

{

"Error": "Following external agent(s) could not be add.",

"Description": [

"The agent name you are trying to add already exists. Please use another agent name. Agent name :<name of the external agent>",

"The agent name you are trying to add already exists. Please use another agent name. Agent name :<name of the external agent>"

]

}

Adding External Agents  in Bulk Using Postman REST Client

Figure 1 : Example to add external agents in bulk using Postman REST Client

Adding External Agents in Bulk using cURL

To add external agents in bulk through the REST API using cURL, the command should be specified in the following format:

curl --location --request POST "http://<eG Manager IP:Port>/api/eg/orchestration/addexternalagent/bulk" -H "managerurl:http://<eG Manager IP:Port>" -H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "Content-Type: multipart/form-data" --form "file=@ Full path to the CSV file"

Figure 2 shows an example of adding external agents in bulk using cURL.

Adding External Agents in Bulk Using cURL

Figure 2 : Adding external agents in bulk using cURL