cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API to pull ALL hostgroup ID's

lee_rovner
Contributor

I am trying to pull in ALL my hostgroup ID's from the DT API.

It used to work using 

https:// xxxxxlive.dynatrace.com/api/v1/entity/infrastructure/hosts?tag=ds%3Aprod&showMonitoringCandidates=false&includeDetails=true

now, I am getting blank hostGroups
3 REPLIES 3

axel_ayala
Dynatrace Advisor
Dynatrace Advisor

You can try using the Monitored Entities API, using the entity type HOST_GROUP should give you what you are looking for:

/api/v2/entities?entitySelector=type%28%22host_group%22%29

 

Hi Axel,

There appears to be a bug in this API, when issuing a nextPageKey parameter is throws an exception

{
  "error": {
    "code": 400,
    "message": "Constraints violated.",
    "constraintViolations": [
      {
        "path": "entitySelector",
        "message": "must not be used in combination with nextPageKey query parameter.",
        "parameterLocation": "QUERY",
        "location": null
      },
      {
        "path": "pageSize",
        "message": "must not be used in combination with nextPageKey query parameter.",
        "parameterLocation": "QUERY",
        "location": null
      }
    ]
  }
}

You must remove ALL parameters before using the nextPageKey or you will get the errors you show here.