Skip to content
Discussion options

You must be logged in to vote

Hi @Emarples!

We'll need to use the action_parameters keyword to add a host to a static group. Try this sample code and let us know if you have any questions.

You will need to use updateHostGroups if you want to update the assignment rule for a dynamic group.

Example

from falconpy import HostGroup

groups = HostGroup(client_id="API_CLIENT_ID", client_secret="API_CLIENT_SECRET")

host_aids_to_add = ['HOST_AID_1', 'HOST_AID_2', 'etc.']

action_parameter = [{
    "name": "filter",
    "value": f"(device_id:{host_aids_to_add})"
}]

result = groups.perform_group_action(action_name="add-hosts", ids="HOST_GROUP_ID_HERE", action_parameters=action_parameter)

print(result)

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@Emarples
Comment options

@jshcodes
Comment options

@Emarples
Comment options

@jshcodes
Comment options

@Emarples
Comment options

Answer selected by Emarples
Comment options

You must be logged in to vote
1 reply
@jshcodes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
API usage General API usage issues and questions hosts Hosts or Host Groups issues and questions SDK usage General SDK usage issues and questions
3 participants