<?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: How to extract values from response body in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/185343#M1281</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/44566"&gt;@Michal_Gebacki&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I remember it works OK.&lt;/P&gt;&lt;P&gt;I have accepted&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/18994"&gt;@alvaro_sanchez&lt;/a&gt;&amp;nbsp; answer as a solution&amp;nbsp; and sorry for the "slight" delay in doing that&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@F2D1C2F7F4E2482D3B1CB233C93F9C13/images/emoticons/facepalm.gif" alt=":facepalm:" title=":facepalm:" /&gt;&lt;/P&gt;&lt;P&gt;Yos&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Apr 2022 15:05:15 GMT</pubDate>
    <dc:creator>Yosi_Neuman</dc:creator>
    <dc:date>2022-04-22T15:05:15Z</dc:date>
    <item>
      <title>How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170644#M908</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Customer asks to monitor OPEN APIC with synthetic so we create http checks with token saved in the vault.&lt;/P&gt;&lt;P&gt;The issue here is that the tokens got only 10 hours lifetime and we need to generate a new token with rest api every hour.&lt;/P&gt;&lt;P&gt;Our intension now is to call the rest api that generate the token on OPEN APIC and with value from the response body to set a value (with&amp;nbsp;&lt;EM&gt;api.setValue(key, value)&lt;/EM&gt;) for the next step which will send dynatrace vault rest api to change the value of the token to the new one.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We need your help here with how to extract values from response body in the post execution step with&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;response.getResponseBody()&lt;/EM&gt; , how can we extract&amp;nbsp;a value after &lt;STRONG&gt;token="&lt;/STRONG&gt; till the next &lt;STRONG&gt;" &lt;/STRONG&gt;from the response body?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Yos&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 19:20:10 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170644#M908</guid>
      <dc:creator>Yosi_Neuman</dc:creator>
      <dc:date>2021-08-11T19:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170688#M910</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it's possible using Request Attributes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More details here &lt;A href="https://www.dynatrace.com/support/help/how-to-use-dynatrace/transactions-and-services/request-attributes/" target="_self"&gt;Request Attributes&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 11:46:00 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170688#M910</guid>
      <dc:creator>Malaik</dc:creator>
      <dc:date>2021-08-12T11:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170701#M911</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/23195"&gt;@Malaik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question is about&amp;nbsp;&lt;STRONG&gt;post-execution script&amp;nbsp;&lt;/STRONG&gt;in &lt;STRONG&gt;http monitor&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;How can we implement RA in http monitor?&lt;/P&gt;&lt;P&gt;Yos&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 13:19:19 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170701#M911</guid>
      <dc:creator>Yosi_Neuman</dc:creator>
      <dc:date>2021-08-12T13:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170721#M913</link>
      <description>&lt;P&gt;Hi Yosi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As the response body is a string, I'd say using a regex match would do the trick, with a capture group somewhat like this (adapt it to the format of your token of course):&lt;BR /&gt;&lt;BR /&gt;api.setValue("token", responseBody.match(new RegExp("token=\"([A-z0-9]+)\""))[1])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Álvaro&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 14:43:21 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170721#M913</guid>
      <dc:creator>alvaro_sanchez</dc:creator>
      <dc:date>2021-08-12T14:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170723#M914</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/18994"&gt;@alvaro_sanchez&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great , will give it a try next week at customer site and will update !&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;Yos&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 15:37:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/170723#M914</guid>
      <dc:creator>Yosi_Neuman</dc:creator>
      <dc:date>2021-08-12T15:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/185331#M1278</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/6931"&gt;@Yosi_Neuman&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm curious how this issue has ended eventually, were you able to find a desired solution as promised last year?&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 12:43:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/185331#M1278</guid>
      <dc:creator>Michal_Gebacki</dc:creator>
      <dc:date>2022-04-22T12:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/185343#M1281</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/44566"&gt;@Michal_Gebacki&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I remember it works OK.&lt;/P&gt;&lt;P&gt;I have accepted&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/18994"&gt;@alvaro_sanchez&lt;/a&gt;&amp;nbsp; answer as a solution&amp;nbsp; and sorry for the "slight" delay in doing that&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@F2D1C2F7F4E2482D3B1CB233C93F9C13/images/emoticons/facepalm.gif" alt=":facepalm:" title=":facepalm:" /&gt;&lt;/P&gt;&lt;P&gt;Yos&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 15:05:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/185343#M1281</guid>
      <dc:creator>Yosi_Neuman</dc:creator>
      <dc:date>2022-04-22T15:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/198435#M1553</link>
      <description>&lt;P&gt;I can confirm that you can use regex in the post-execution synthetic script. Here is who I did it for our application.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jkinner_0-1668543806920.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/8503i3EA966612353526C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jkinner_0-1668543806920.png" alt="jkinner_0-1668543806920.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 20:23:48 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/198435#M1553</guid>
      <dc:creator>jkinner</dc:creator>
      <dc:date>2022-11-15T20:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/223008#M2065</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to capture a specific value from the response of a HTTP (API) request.&lt;/P&gt;&lt;P&gt;I have tried the approaches suggested by&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/18994"&gt;@alvaro_sanchez&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/55548"&gt;@jkinner&lt;/a&gt;&amp;nbsp;above, but with no success.&lt;/P&gt;&lt;P&gt;I've attached an example of the response from the API request.&lt;/P&gt;&lt;P&gt;I specifically need to capture the value returned for "policyNo" into a new variable, "policyNumber".&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions on how I can get this working?&lt;/P&gt;&lt;P&gt;jmodeorain14&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 08:44:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/223008#M2065</guid>
      <dc:creator>jmodeorain14</dc:creator>
      <dc:date>2023-09-14T08:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/223685#M2067</link>
      <description>&lt;P&gt;I was able to extract the value of policyNo from the response body.&lt;/P&gt;&lt;P&gt;In case anyone is interested or has a similar challenge in future, here is the post-execution script I used:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jmodeorain14_0-1695369653731.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/14257i37C6AA64533825B9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jmodeorain14_0-1695369653731.png" alt="jmodeorain14_0-1695369653731.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;jmodeorain14&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 08:02:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/223685#M2067</guid>
      <dc:creator>jmodeorain14</dc:creator>
      <dc:date>2023-09-22T08:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from response body</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/223746#M2068</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;And where you put this code?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 10:02:57 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-extract-values-from-response-body/m-p/223746#M2068</guid>
      <dc:creator>Malaik</dc:creator>
      <dc:date>2023-09-23T10:02:57Z</dc:date>
    </item>
  </channel>
</rss>

