<?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 Create HTTP Monitor using API via PowerShell script in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Create-HTTP-Monitor-using-API-via-PowerShell-script/m-p/200051#M2179</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to automate the creation of an HTTP monitor using PowerShell scripts. However, I always get a 400 when I try to pass the value of the location via variable. Please see below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[array]$location = "[GEOLOCATION-2FD31C834DE4D601]"&lt;BR /&gt;&lt;BR /&gt;Write-Host $location&lt;BR /&gt;$headers = @{&lt;BR /&gt;Authorization= ' Api-Token xxxxxxxxxxx'&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;$body = '{&lt;BR /&gt;"frequencyMin": 10,&lt;BR /&gt;"anomalyDetection": {&lt;BR /&gt;"outageHandling": {&lt;BR /&gt;"globalOutage": true,&lt;BR /&gt;"localOutage": false,&lt;BR /&gt;"localOutagePolicy": {&lt;BR /&gt;"affectedLocations": 1,&lt;BR /&gt;"consecutiveRuns": 3&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"loadingTimeThresholds": {&lt;BR /&gt;"enabled": false&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"type": "HTTP",&lt;BR /&gt;"name": "Created_via_Devops_pipeline",&lt;BR /&gt;"locations": $location ,&lt;BR /&gt;"enabled": true,&lt;BR /&gt;"keyPerformanceMetrics": {&lt;BR /&gt;"loadActionKpm": "VISUALLY_COMPLETE",&lt;BR /&gt;"xhrActionKpm": "VISUALLY_COMPLETE"&lt;BR /&gt;},&lt;BR /&gt;"script": {&lt;BR /&gt;"version": "1.0",&lt;BR /&gt;"requests": [{&lt;BR /&gt;"description": "CreatedByDevops",&lt;BR /&gt;"url": "&lt;A href="https://{environmentid}.live.dynatrace.com/api/v1/synthetic/monitors" target="_blank" rel="noopener"&gt;https://{environmentid}.live.dynatrace.com/api/v1/synthetic/monitors&lt;/A&gt; -Method post -Headers $headers -ContentType 'application/json' -body $body&lt;/P&gt;</description>
    <pubDate>Mon, 12 Dec 2022 10:31:59 GMT</pubDate>
    <dc:creator>sriramprabhakar</dc:creator>
    <dc:date>2022-12-12T10:31:59Z</dc:date>
    <item>
      <title>Create HTTP Monitor using API via PowerShell script</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Create-HTTP-Monitor-using-API-via-PowerShell-script/m-p/200051#M2179</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to automate the creation of an HTTP monitor using PowerShell scripts. However, I always get a 400 when I try to pass the value of the location via variable. Please see below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[array]$location = "[GEOLOCATION-2FD31C834DE4D601]"&lt;BR /&gt;&lt;BR /&gt;Write-Host $location&lt;BR /&gt;$headers = @{&lt;BR /&gt;Authorization= ' Api-Token xxxxxxxxxxx'&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;$body = '{&lt;BR /&gt;"frequencyMin": 10,&lt;BR /&gt;"anomalyDetection": {&lt;BR /&gt;"outageHandling": {&lt;BR /&gt;"globalOutage": true,&lt;BR /&gt;"localOutage": false,&lt;BR /&gt;"localOutagePolicy": {&lt;BR /&gt;"affectedLocations": 1,&lt;BR /&gt;"consecutiveRuns": 3&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"loadingTimeThresholds": {&lt;BR /&gt;"enabled": false&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"type": "HTTP",&lt;BR /&gt;"name": "Created_via_Devops_pipeline",&lt;BR /&gt;"locations": $location ,&lt;BR /&gt;"enabled": true,&lt;BR /&gt;"keyPerformanceMetrics": {&lt;BR /&gt;"loadActionKpm": "VISUALLY_COMPLETE",&lt;BR /&gt;"xhrActionKpm": "VISUALLY_COMPLETE"&lt;BR /&gt;},&lt;BR /&gt;"script": {&lt;BR /&gt;"version": "1.0",&lt;BR /&gt;"requests": [{&lt;BR /&gt;"description": "CreatedByDevops",&lt;BR /&gt;"url": "&lt;A href="https://{environmentid}.live.dynatrace.com/api/v1/synthetic/monitors" target="_blank" rel="noopener"&gt;https://{environmentid}.live.dynatrace.com/api/v1/synthetic/monitors&lt;/A&gt; -Method post -Headers $headers -ContentType 'application/json' -body $body&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 10:31:59 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Create-HTTP-Monitor-using-API-via-PowerShell-script/m-p/200051#M2179</guid>
      <dc:creator>sriramprabhakar</dc:creator>
      <dc:date>2022-12-12T10:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create HTTP Monitor using API via PowerShell script</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Create-HTTP-Monitor-using-API-via-PowerShell-script/m-p/200769#M2212</link>
      <description>&lt;P&gt;Hi! You're missing quotation marks around the location ID. Please try:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;$location='["GEOLOCATION-2FD31C834DE4D601"]'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 11:48:50 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Create-HTTP-Monitor-using-API-via-PowerShell-script/m-p/200769#M2212</guid>
      <dc:creator>zofiatarant</dc:creator>
      <dc:date>2022-12-19T11:48:50Z</dc:date>
    </item>
  </channel>
</rss>

