<?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: Can I use API to realize Put Metric events setting? in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Can-I-use-API-to-realize-Put-Metric-events-setting/m-p/221100#M2623</link>
    <description>&lt;P&gt;Creating a new metric event through the API can be achieved like follow:&lt;/P&gt;&lt;P&gt;(This is just a curl example with some dummy payload, you would need to adjust fields to your needs)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl --location --request POST 'https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?validateOnly=false' \
--header 'accept: application/json; charset=utf-8' \
--header 'Authorization: Api-Token dt0c01.5VXCARPRP52BZNJVBUDSMQA5....' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '[
{
  "scope": "environment",
  "schemaId": "builtin:anomaly-detection.metric-events",
    "value": {
    "enabled": false,
    "summary": "DEMO ALERT",
    "queryDefinition": {
      "type": "METRIC_KEY",
      "metricKey": "builtin:host.cpu.usage",
      "aggregation": "AVG",
      "entityFilter": {
        "conditions": []
      },
      "dimensionFilter": []
    },
    "modelProperties": {
      "type": "STATIC_THRESHOLD",
      "threshold": 1,
      "alertOnNoData": false,
      "alertCondition": "ABOVE",
      "violatingSamples": 1,
      "samples": 3,
      "dealertingSamples": 3
    },
    "eventTemplate": {
      "title": "DEMO TITLE",
      "description": "The {metricname} value of {severity} was {alert_condition} your custom threshold of {threshold}.",
      "eventType": "RESOURCE",
      "davisMerge": true,
      "metadata": []
    },
    "eventEntityDimensionKey": "dt.entity.host"
  }
}
]'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The response on successful creation looks like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
    {
        "code": 200,
        "objectId": "vu9U3hXa3q0AAAABACdidWlsdGluOmFub21hbHktZGV0ZWN0aW9uLm1ldHJpYy1ldmVudHMABnRlbmFudAAGdGVuYW50ACRiN2JhOTU2Zi0xNTMwLTNiZTQtYWNiYS0zMjc5YThjODk3ZmG-71TeFdrerQ"
    }
]&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 21 Aug 2023 11:28:13 GMT</pubDate>
    <dc:creator>mark_bley</dc:creator>
    <dc:date>2023-08-21T11:28:13Z</dc:date>
    <item>
      <title>Can I use API to realize Put Metric events setting?</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Can-I-use-API-to-realize-Put-Metric-events-setting/m-p/220638#M2619</link>
      <description>&lt;P&gt;Click the API on the page of Metric events, and the system gives the method of obtaining page data by default, but if I want to realize new Metric events through API, can it be realized? Because put/settings/objects/{objectid} in API V2.&lt;BR /&gt;Updates an existing settings object and POST /settings/objects Creates a new settings object didn't make it clear.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 07:43:09 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Can-I-use-API-to-realize-Put-Metric-events-setting/m-p/220638#M2619</guid>
      <dc:creator>kanna</dc:creator>
      <dc:date>2023-08-16T07:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use API to realize Put Metric events setting?</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Can-I-use-API-to-realize-Put-Metric-events-setting/m-p/220783#M2620</link>
      <description>&lt;P&gt;I'm not 100% of the true ask of this question but If you are looking to Post new Custom Events for alerting, It can be done via the Environment V2 &amp;gt; Settings - Objects, From there you will use&amp;nbsp;&lt;SPAN&gt;builtin:anomaly-detection.metric-events as the Schema&amp;nbsp;ID and then get the&amp;nbsp;ID of the item you want. Thake that ID and get the settings of that object ID, edit and report it as needed or even create a net new set up via the&amp;nbsp;Posting option.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChadTurner_0-1692190481169.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/13622iFBCDC885A7DABD26/image-size/large?v=v2&amp;amp;px=999" role="button" title="ChadTurner_0-1692190481169.png" alt="ChadTurner_0-1692190481169.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 12:54:57 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Can-I-use-API-to-realize-Put-Metric-events-setting/m-p/220783#M2620</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-08-16T12:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use API to realize Put Metric events setting?</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Can-I-use-API-to-realize-Put-Metric-events-setting/m-p/221100#M2623</link>
      <description>&lt;P&gt;Creating a new metric event through the API can be achieved like follow:&lt;/P&gt;&lt;P&gt;(This is just a curl example with some dummy payload, you would need to adjust fields to your needs)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl --location --request POST 'https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?validateOnly=false' \
--header 'accept: application/json; charset=utf-8' \
--header 'Authorization: Api-Token dt0c01.5VXCARPRP52BZNJVBUDSMQA5....' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '[
{
  "scope": "environment",
  "schemaId": "builtin:anomaly-detection.metric-events",
    "value": {
    "enabled": false,
    "summary": "DEMO ALERT",
    "queryDefinition": {
      "type": "METRIC_KEY",
      "metricKey": "builtin:host.cpu.usage",
      "aggregation": "AVG",
      "entityFilter": {
        "conditions": []
      },
      "dimensionFilter": []
    },
    "modelProperties": {
      "type": "STATIC_THRESHOLD",
      "threshold": 1,
      "alertOnNoData": false,
      "alertCondition": "ABOVE",
      "violatingSamples": 1,
      "samples": 3,
      "dealertingSamples": 3
    },
    "eventTemplate": {
      "title": "DEMO TITLE",
      "description": "The {metricname} value of {severity} was {alert_condition} your custom threshold of {threshold}.",
      "eventType": "RESOURCE",
      "davisMerge": true,
      "metadata": []
    },
    "eventEntityDimensionKey": "dt.entity.host"
  }
}
]'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The response on successful creation looks like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
    {
        "code": 200,
        "objectId": "vu9U3hXa3q0AAAABACdidWlsdGluOmFub21hbHktZGV0ZWN0aW9uLm1ldHJpYy1ldmVudHMABnRlbmFudAAGdGVuYW50ACRiN2JhOTU2Zi0xNTMwLTNiZTQtYWNiYS0zMjc5YThjODk3ZmG-71TeFdrerQ"
    }
]&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Aug 2023 11:28:13 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Can-I-use-API-to-realize-Put-Metric-events-setting/m-p/221100#M2623</guid>
      <dc:creator>mark_bley</dc:creator>
      <dc:date>2023-08-21T11:28:13Z</dc:date>
    </item>
  </channel>
</rss>

