Symantec Privileged Access Management

 View Only

 How to Add Devices to Devices Groups via REST APIs?

Tiffany Kongpachith's profile image
Tiffany Kongpachith posted Apr 27, 2021 08:52 AM
Hello,

Is there a proactive way to bulk add Devices to a corresponding or similar Device Group using the REST APIs that does not involve inputting Group Id and Device Id?
The goal is importing a CSV to create multiple Devices in PAM.
I noticed from an export of the CSV for testing purposes that a device listed had 2 Device Groups that the Device was a member off and delimited by a pipe (|).

From my experience, it seems like adding a Device to a Group can only be done by a 1 to 1 ratio. Such as: 
POST /api.php/v1/deviceGroups.json/{groupId}/devices{deviceId}.

Then looking through the Device API and Device Group API - I know that the following could be possible for multiple membership assignment:
1. PUT /api.php/v1/deviceGroups.json to update a Device Group.
Then enter the values for groupId and device Ids to associate.

2. Another method is, if a Device Group already exists to grab its groupId and use a PUT /api.php/v1/devices.json and enter the values for: the deviceId and deviceGroupMembershipsIds to associate to which Groups.

---

Is there another method that could accomplish this that I might have missed?

Any recommendations to accomplish having bulk Devices assigned to a Device Group via the APIs or a Device Group knows how to associate its appropriate Group Members/Devices?
Ralf Prigl's profile image
Broadcom Employee Ralf Prigl
Hello Tiffany, The GET /api.php/v1/devices.json gives you the IDs of all devices. Most API calls require IDs to be provided, but those IDs can be retrieved programmatically with other calls. An alternative would be to update the group membership entries in the device export and import the updated file.