Resolve constraint issues with metricSelector in API

Hi Team,

We are trying to automate metrics for our workloads and see below exception with 400 code

Exception in thread “main” java.io.IOException:

Error Code: 400

URL: https://<>/query?from=2024-11-21T17:30:01.000&to=2024-11-21T20:01:59.000&metricSelector=builtin:containers.cpu.usagePercent:filter(and(in(“dt.entity.container_group_instance”,entitySelector(“type(container_group_instance),entityName(~”********-~“)”)))):splitBy(“dt.entity.container_group_instance”):avg:auto:sort(value(avg,descending)):limit(10)

Response Text: {“error”:{“code”:400,“message”:“Constraints violated.”,“constraintViolations”:[{“path”:“nextPageKey”,“message”:“expected one of nextPageKey or metricSelector to be specified”,“parameterLocation”:“QUERY”,“location”:null}]}}

<> is host, ** is our workload, masking it for data privacy.

metricSelector is mentioned in URL yet seeing same errorcode, adding pageKey as suggested shows combination is not supported. Stuck here please help

Please note that the same call works using postman

Hello @ajithsaranya

Kindly ensure the specified parameters in the Api call meets the defined parameters in Dynatrace doc to avoid exposure to the highlighted error:

Hoping it adds value

Regards,

Peter