Forum Discussion

msterry's avatar
7 years ago

REST API - Devices associated with DataSources

I'm currently working on a project to validate any configured LM alerts have an associated documentation - our documentation should have the datasource name as part of the title. Furthermore, I need to filter out devices that are not in my team's escalation path/rule. e.x. filter out "dev" environment devices.

  • I'm pulling a list of datasources using the REST API '/setting/datasources' endpoint. 
  • I use a filter to only grab those that match my team's given escalation path/rule.
  • I then pull the datasource properties, specifically the "appliesTo" value in the json response.
  • I'm then converting those values into filters that can be used on the 'getDevices' REST API endpoint

Is there an easier and/or better way to match datasources back to devices? The 'appliesTo' values returned do not use the same structure and naming convention used with the 'getDevices' filters.