17 May 2023 11:55 AM - last edited on 17 May 2023 03:14 PM by MaciejNeumann
Hi Team,
I am trying to execute get objects API but not sure what to enter in schemaIds, how can I find schemaID to get list of one agent deployed list.
Thanks and Regards
Pooja P
Solved! Go to Solution.
17 May 2023 12:18 PM
Hi Pooja,
You can use v2 Settings API to get the list of all the available schemas.
API: https://{environmentid}.live.dynatrace.com/api/v2/settings/schemas
Response:
{
"schemaId": "builtin:monitored-technologies.php",
"displayName": "PHP",
"latestSchemaVersion": "0.0.3"
}
You can use above schemaId to get or update the objects.
Reference: https://www.dynatrace.com/support/help/dynatrace-api/environment-api/settings/schemas/get-all
17 May 2023 08:54 PM
Hi @Pooja_3,
I don't know if you are looking for the list of deployed hosts or if you just need the OneAgent default version, if you are looking for the list of hosts, you need to use entity API not settings API.
entity API v2:
/api/v2/entities?entitySelector=type(host)&fields=+properties.osType,+properties.monitoringMode
or you can use API v1:
/api/v1/entity/infrastructure/hosts
as for settings API, you can find all the available schemas here
18 May 2023 02:10 AM
thanks @Naveen and @Mohamed_Hamdy - I am able to get the list of schema IDs. Basically, I am trying to get list of hosts on which one agents is deployed in last 3 months. From UI I can't option to save that list. My requirement is to block the traffic of certain IPs with same subnet but we have few ECS containers where one agent is deployed. We can block traffic at IP level but at API level it's quite difficult. If you have better solution for this, it would be helpful.
18 May 2023 05:45 AM
Hi @Pooja_3 ,
I am not sure what exactly you trying to do, but you can use api/v1/oneagents?includeDetails=false API to get the list of host where oneagent is installed and save it as a JSON file. Could you please share the API you are using.
Trying using script may be bash or powershell.
18 May 2023 09:35 AM
@Naveen , I think @Pooja_3 is looking for this, but for the last three months, so you can use the following as well:
/api/v1/oneagents?includeDetails=false&startTimestamp=1679097600000&endTimestamp=1684368000000
for more details check OneAgent on Host API
to convert timestamps to milliseconds use this