<?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 can I make a curl request in my browser monitor in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/how-can-I-make-a-curl-request-in-my-browser-monitor/m-p/189482#M1389</link>
    <description>&lt;P&gt;Hannah, thank you so much for doing this work and helping. I dont know js like this so you are a huge help right now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jun 2022 12:15:47 GMT</pubDate>
    <dc:creator>jordan_rose</dc:creator>
    <dc:date>2022-06-29T12:15:47Z</dc:date>
    <item>
      <title>how can I make a curl request in my browser monitor</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/how-can-I-make-a-curl-request-in-my-browser-monitor/m-p/189420#M1387</link>
      <description>&lt;P&gt;As one of my synthetic events in my browser monitor I have need to make a curl request and capture some of the return data to use in another step. I am struggling on how to convert to js or if this is possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on this is very appreciated.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Here is post request.&lt;/P&gt;&lt;P&gt;curl --location --request POST '&lt;A href="https://someurl.com/auth/oauth2/access_token" target="_blank"&gt;https://someurl.com/auth/oauth2/access_token&lt;/A&gt;' \&lt;BR /&gt;--header 'Content-Type: application/x-www-form-urlencoded' \&lt;BR /&gt;--header 'Cookie: NSC_bvuifoujdbujpo-tuhb_443=ffffffffaf1a5c9b45525d5f4f58455e445a4a4229a0; NSC_jh-tuhb_443=ffffffffaf1a5c9445525d5f4f58455e445a4a4216cb' \&lt;BR /&gt;--data-urlencode 'grant_type=authorization_code' \&lt;BR /&gt;--data-urlencode 'code=LLz_H3aMMGZle7PtqJxrA8cj0fU' \&lt;BR /&gt;--data-urlencode 'client_id=902c9ae8b9ac98fb12a785e925f889a0' \&lt;BR /&gt;--data-urlencode 'redirect_uri=&lt;A href="https://oidcdebugger.com/debug" target="_blank"&gt;https://oidcdebugger.com/debug&lt;/A&gt;' \&lt;BR /&gt;--data-urlencode 'client_secret=fd7d4bf54d68edc06559ffdb5f0265a8'&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 19:48:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/how-can-I-make-a-curl-request-in-my-browser-monitor/m-p/189420#M1387</guid>
      <dc:creator>jordan_rose</dc:creator>
      <dc:date>2022-06-28T19:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: how can I make a curl request in my browser monitor</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/how-can-I-make-a-curl-request-in-my-browser-monitor/m-p/189479#M1388</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;
&lt;PRE&gt;api.startAsyncSyntheticEvent();
fetch('&amp;lt;yoururl&amp;gt;', {
    method: 'POST',
    headers: {
        'Cookie: NSC_bvuifoujdbujpo-tuhb_443=ffffffffaf1a5c9b45525d5f4f58455e445a4a4229a0; NSC_jh-tuhb_443=ffffffffaf1a5c9445525d5f4f58455e445a4a4216cb',
		'Content-Type': 'application/x-www-form-urlencoded'
    },    
    body: new URLSearchParams({
        'grant_type': 'authorization_code',
        'code': 'LLz_H3aMMGZle7PtqJxrA8cj0fU',
        'client_id': '902c9ae8b9ac98fb12a785e925f889a0',
		'redirect_uri': 'https://oidcdebugger.com/debug',
		'client_secret': 'fd7d4bf54d68edc06559ffdb5f0265a8'
    }
}).then(function(response) {
        if (!response.ok) {
            throw Error(response.status + &lt;SPAN&gt;":"&lt;/SPAN&gt; + response.statusText);
        }
        return response;
   }).then(response =&amp;gt; response.text()).then(text =&amp;gt; {
        try {
            api.info('Resp length:  ' + text.length);
            if (text.indexOf('code') &amp;gt;= 0) {
                &amp;lt;your code to retrieve token&amp;gt;
                api.setValue(&lt;SPAN&gt;"token"&lt;/SPAN&gt;, token);
                api.finish();
            } else {
                api.fail(&lt;SPAN&gt;"Invalid Response"&lt;/SPAN&gt;);
            }
        } catch (err) {
            api.fail(&lt;SPAN&gt;"Failed to Execute"&lt;/SPAN&gt;);
        }
   }).catch(function(error) {
        api.fail(error); 
   });
&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jun 2022 11:05:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/how-can-I-make-a-curl-request-in-my-browser-monitor/m-p/189479#M1388</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2022-06-29T11:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: how can I make a curl request in my browser monitor</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/how-can-I-make-a-curl-request-in-my-browser-monitor/m-p/189482#M1389</link>
      <description>&lt;P&gt;Hannah, thank you so much for doing this work and helping. I dont know js like this so you are a huge help right now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 12:15:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/how-can-I-make-a-curl-request-in-my-browser-monitor/m-p/189482#M1389</guid>
      <dc:creator>jordan_rose</dc:creator>
      <dc:date>2022-06-29T12:15:47Z</dc:date>
    </item>
  </channel>
</rss>

