<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: New to the V2 Metrics API - Limiting fields in Response in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163893#M1552</link>
    <description>&lt;P&gt;oi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/34149"&gt;@louis_gallo&lt;/a&gt;&amp;nbsp; about question one something isn't right because "field=" is not included directly in an Api v2 call like you are using "&lt;STRONG&gt;api/v2/metrics/query?&lt;/STRONG&gt;"&lt;BR /&gt;&lt;BR /&gt;you can find "field=" in this kind of api:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;/api/v2/entities?&lt;/STRONG&gt;entitySelector=type%28%22HOST%22%29&amp;amp;from=now-1h&amp;amp;&lt;STRONG&gt;fields=&lt;/STRONG&gt;%2Bproperties.osType&lt;/PRE&gt;
&lt;P data-unlink="true"&gt;Plus the api call in question 1 seems to contain different error since you have at least two (?):&lt;BR /&gt;&lt;BR /&gt;/api/v2/metrics/query?fields=-metricId?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If you go on more detail maybe we can help you out &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Let us know how it went!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Apr 2023 13:24:06 GMT</pubDate>
    <dc:creator>y_buccellato</dc:creator>
    <dc:date>2023-04-24T13:24:06Z</dc:date>
    <item>
      <title>New to the V2 Metrics API - Limiting fields in Response</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163839#M1550</link>
      <description>&lt;P&gt;This command works great, and I get CPU stats for my server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;https://********.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu(system)&amp;amp;resolution=1m&amp;amp;from=now1h&amp;amp;to=now&amp;amp;entitySelector=type(HOST),tag(server:myserver.example.com)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am now trying to dress that up. How can I limit or add fields in the response?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QUESTION 1 - If I try limiting the fields by removing one, it errors out. What am I doing wrong, or is this not allowed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;https://&amp;nbsp;*******&amp;nbsp;.live.dynatrace.com/api/v2/metrics/query?fields=-metricId?metricSelector=builtin:host.cpu.(system)&amp;amp;resolution=1m&amp;amp;from=now-1h&amp;amp;to=now&amp;amp;entitySelector=type(HOST),tag(server:myserver.example.com)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QUESTION 2 - What if I want to have the server tag name in the CSV output? Is that possible. I can always add it after the API query if I have to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm really trying to dress up the CSV extract to feed into a statistical engine like R.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any advice is appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lou (API V2 Newbie)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 13:23:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163839#M1550</guid>
      <dc:creator>louis_gallo</dc:creator>
      <dc:date>2023-04-24T13:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: New to the V2 Metrics API - Limiting fields in Response</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163887#M1551</link>
      <description>&lt;P&gt;Okay, partial success. I can get the server name in the names transformation. Yea!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;https://xxxxxxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.(system):names:merge(1)&amp;amp;resolution=1m&amp;amp;from=now-1h&amp;amp;to=now&amp;amp;entitySelector=type(HOST),tag(MyApplication:MyApp)&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 13:23:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163887#M1551</guid>
      <dc:creator>louis_gallo</dc:creator>
      <dc:date>2023-04-24T13:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: New to the V2 Metrics API - Limiting fields in Response</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163893#M1552</link>
      <description>&lt;P&gt;oi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/34149"&gt;@louis_gallo&lt;/a&gt;&amp;nbsp; about question one something isn't right because "field=" is not included directly in an Api v2 call like you are using "&lt;STRONG&gt;api/v2/metrics/query?&lt;/STRONG&gt;"&lt;BR /&gt;&lt;BR /&gt;you can find "field=" in this kind of api:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;/api/v2/entities?&lt;/STRONG&gt;entitySelector=type%28%22HOST%22%29&amp;amp;from=now-1h&amp;amp;&lt;STRONG&gt;fields=&lt;/STRONG&gt;%2Bproperties.osType&lt;/PRE&gt;
&lt;P data-unlink="true"&gt;Plus the api call in question 1 seems to contain different error since you have at least two (?):&lt;BR /&gt;&lt;BR /&gt;/api/v2/metrics/query?fields=-metricId?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If you go on more detail maybe we can help you out &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Let us know how it went!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 13:24:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163893#M1552</guid>
      <dc:creator>y_buccellato</dc:creator>
      <dc:date>2023-04-24T13:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: New to the V2 Metrics API - Limiting fields in Response</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163968#M1553</link>
      <description>&lt;P&gt;Hi Lou,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 1 - the "fields" parameter is not valid for the &lt;STRONG&gt;/metrics/query&lt;/STRONG&gt; API endpoint. This is why it errors out. The "fields" parameter can be used instead with the &lt;STRONG&gt;/metrics&lt;/STRONG&gt; endpoint which is used to retrieve information about the metric definition itslef. You can use this endpoint for example to find out what dimensions can a metric be split by (this is done by adding &lt;STRONG&gt;fields=+dimensionDefinitions&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question2 - names of entities and dimensions returned by the&amp;nbsp;&lt;STRONG&gt;/metrics/query&lt;/STRONG&gt; API calls can be added in using the :names: transformation. Tags cannot be added as dimensions, but they can be used for filtering out entities that are returned in the result set. You can do that within the entitySelector parameter (e.g. &lt;STRONG&gt;entitySelector=type(service),tag(Environment:Staging)&lt;/STRONG&gt; for including only services tagged with Environment=Staging)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Radu&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 07:10:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/New-to-the-V2-Metrics-API-Limiting-fields-in-Response/m-p/163968#M1553</guid>
      <dc:creator>Radu</dc:creator>
      <dc:date>2021-04-08T07:10:22Z</dc:date>
    </item>
  </channel>
</rss>

