Forum Discussion
EdmondNader
Aug 18, 2023Copper Contributor
AddOrRemoveTagForMultipleMachines api limitation when machine id doesn't exist
Dears,
I have noticed when using the Defender for endpoint api for AddOrRemoveTagForMultipleMachines that the whole task fails to add/remove tag if one of the device IDs array is inactive or not found anymore
is there a way to skip the ID ( inactive or not found) instead of the whole request to fail and not tagging any other valid ones?
Thanks
- jbmartin6Iron ContributorPull the list of all your devices using the devices API and then check that all your device IDs are valid before submitting a request to AddOrRemoveTagForMultipleMachines
- EdmondNaderCopper ContributorThank for your suggestion
I was thinking of the same but pulling all our device IDs take long time and reach the count limit if we are using the List machines API, so this will encounter in more API calls
the main aim of using the bulk tagging instead of individual API call is do reduce the overall API calls for the needed- jbmartin6Iron ContributorJust getting the list of all machines is just one request. It only takes a few seconds for our 3000 machines. Just using the 'machines' API with no filter returns all machines, though it was a page limit of 10k so if you have more than that you would use one API call per page. Should still be well within the limit. You can use a oData query in the API request to only get machines in an Active state or any other way you want to narrow the results down.