<?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: HTTP monitor: How do I validate on only parts of a JSON response? in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/HTTP-monitor-How-do-I-validate-on-only-parts-of-a-JSON-response/m-p/193238#M1475</link>
    <description>&lt;P&gt;You will need to parse the json with javascript code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "totalCount": 3,
    "nextPageKey": null,
    "resolution": "1m",
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;body = response.getResponseBody();
obj = JSON.parse(body);
totalCount = obj.totalCount;
api.setValue("totalCount", totalCount);
if (totalCount == 0) {
    api.fail("Total Count is null");
} else {
    api.info("Total Count is not null");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You just need to proper parse the result json you get from the status page to get the proper field for validation.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards&lt;/P&gt;</description>
    <pubDate>Wed, 24 Aug 2022 16:33:51 GMT</pubDate>
    <dc:creator>dannemca</dc:creator>
    <dc:date>2022-08-24T16:33:51Z</dc:date>
    <item>
      <title>HTTP monitor: How do I validate on only parts of a JSON response?</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/HTTP-monitor-How-do-I-validate-on-only-parts-of-a-JSON-response/m-p/193227#M1474</link>
      <description>&lt;P&gt;I'm currently working on an HTTP monitor where I don't know how to validate the JSON response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is a status.io endpoint that I would like to query, but the JSON response contains more info than I need. Is it possible to isolate two objects with post-execution scripts prior to validation? Let's say I wanted to validate on &lt;STRONG&gt;Voice DK&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;Agent application &lt;/STRONG&gt;status.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If anyone could point me in the right direction it would be much appreciated&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Endpoint&lt;/STRONG&gt;:&lt;BR /&gt;&lt;A href="https://api.status.io/1.0/status/58207f2bf02471510e000303" target="_blank" rel="noopener"&gt;https://api.status.io/1.0/status/58207f2bf02471510e000303&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 08:25:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/HTTP-monitor-How-do-I-validate-on-only-parts-of-a-JSON-response/m-p/193227#M1474</guid>
      <dc:creator>rsmsdk</dc:creator>
      <dc:date>2022-08-25T08:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP monitor: How do I validate on only parts of a JSON response?</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/HTTP-monitor-How-do-I-validate-on-only-parts-of-a-JSON-response/m-p/193238#M1475</link>
      <description>&lt;P&gt;You will need to parse the json with javascript code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "totalCount": 3,
    "nextPageKey": null,
    "resolution": "1m",
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;body = response.getResponseBody();
obj = JSON.parse(body);
totalCount = obj.totalCount;
api.setValue("totalCount", totalCount);
if (totalCount == 0) {
    api.fail("Total Count is null");
} else {
    api.info("Total Count is not null");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You just need to proper parse the result json you get from the status page to get the proper field for validation.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 16:33:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/HTTP-monitor-How-do-I-validate-on-only-parts-of-a-JSON-response/m-p/193238#M1475</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2022-08-24T16:33:51Z</dc:date>
    </item>
  </channel>
</rss>

