Chilkat Online Tools

SQL Server / Datadog API Collection / Validate an existing monitor

Back to Collection Items

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    -- Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    -- The following JSON is sent in the request body.

    -- {
    --   "type": "query alert",
    --   "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
    --   "created": "1989-12-01T14:28:43.831Z",
    --   "creator": {
    --     "email": "officia sunt",
    --     "handle": "pariatur",
    --     "name": "aute do"
    --   },
    --   "deleted": "2020-10-30T20:46:24.520Z",
    --   "id": -50675854,
    --   "matching_downtimes": [
    --     {
    --       "id": 1625,
    --       "end": 1412792983,
    --       "scope": [
    --         "env:staging"
    --       ],
    --       "start": 1412792983
    --     },
    --     {
    --       "id": 1625,
    --       "end": 1412792983,
    --       "scope": [
    --         "env:staging"
    --       ],
    --       "start": 1412792983
    --     }
    --   ],
    --   "message": "ullamco incididunt cupidatat",
    --   "modified": "1981-03-27T05:04:03.098Z",
    --   "multi": false,
    --   "name": "My monitor",
    --   "options": {
    --     "aggregation": {
    --       "group_by": "host",
    --       "metric": "metrics.name",
    --       "type": "count"
    --     },
    --     "device_ids": [
    --       "mobile_small",
    --       "chrome.tablet"
    --     ],
    --     "enable_logs_sample": false,
    --     "enable_samples": false,
    --     "escalation_message": "none",
    --     "evaluation_delay": -52819274,
    --     "group_retention_duration": "dolor Lorem qui",
    --     "groupby_simple_monitor": false,
    --     "include_tags": true,
    --     "locked": false,
    --     "min_failure_duration": 0,
    --     "min_location_failed": 1,
    --     "new_group_delay": -94315945,
    --     "new_host_delay": 300,
    --     "no_data_timeframe": -86360342,
    --     "notification_preset_name": "show_all",
    --     "notify_audit": false,
    --     "notify_by": [
    --       "labore dolore",
    --       "deserunt commodo consectetur"
    --     ],
    --     "notify_no_data": false,
    --     "on_missing_data": "resolve",
    --     "renotify_interval": null,
    --     "renotify_occurrences": 56355858,
    --     "renotify_statuses": [
    --       "warn",
    --       "no data"
    --     ],
    --     "require_full_window": false,
    --     "scheduling_options": {
    --       "evaluation_window": {
    --         "day_starts": "04:00",
    --         "hour_starts": 0,
    --         "month_starts": 1
    --       }
    --     },
    --     "silenced": {
    --       "non_6f_": 77287100
    --     },
    --     "synthetics_check_id": "culpa in laborum irure",
    --     "threshold_windows": {
    --       "recovery_window": "culpa cupidatat Lorem ut",
    --       "trigger_window": "fugiat officia mollit esse quis"
    --     },
    --     "thresholds": {
    --       "critical": -44507487.0891542,
    --       "critical_recovery": 94365870.17342958,
    --       "ok": 26645340.31156695,
    --       "unknown": -32772943.396166816,
    --       "warning": 75330874.10211122,
    --       "warning_recovery": 30665996.226613894
    --     },
    --     "timeout_h": null,
    --     "variables": [
    --       {
    --         "data_source": "rum",
    --         "compute": {
    --           "aggregation": "avg",
    --           "interval": 60000,
    --           "metric": "@duration"
    --         },
    --         "name": "query_errors",
    --         "group_by": [
    --           {
    --             "facet": "status",
    --             "limit": 10,
    --             "sort": {
    --               "aggregation": "avg",
    --               "metric": "minim tempor i",
    --               "order": "desc"
    --             }
    --           },
    --           {
    --             "facet": "status",
    --             "limit": 10,
    --             "sort": {
    --               "aggregation": "avg",
    --               "metric": "Ut fugiat officia",
    --               "order": "desc"
    --             }
    --           }
    --         ],
    --         "indexes": [
    --           "days-3",
    --           "days-7"
    --         ],
    --         "search": {
    --           "query": "service:query"
    --         }
    --       },
    --       {
    --         "data_source": "rum",
    --         "compute": {
    --           "aggregation": "avg",
    --           "interval": 60000,
    --           "metric": "@duration"
    --         },
    --         "name": "query_errors",
    --         "group_by": [
    --           {
    --             "facet": "status",
    --             "limit": 10,
    --             "sort": {
    --               "aggregation": "avg",
    --               "metric": "do velit",
    --               "order": "desc"
    --             }
    --           },
    --           {
    --             "facet": "status",
    --             "limit": 10,
    --             "sort": {
    --               "aggregation": "avg",
    --               "metric": "amet proident anim in",
    --               "order": "desc"
    --             }
    --           }
    --         ],
    --         "indexes": [
    --           "days-3",
    --           "days-7"
    --         ],
    --         "search": {
    --           "query": "service:query"
    --         }
    --       }
    --     ]
    --   },
    --   "overall_state": "Warn",
    --   "priority": 1,
    --   "restricted_roles": [
    --     "enim qui cillum est",
    --     "quis ut"
    --   ],
    --   "state": {
    --     "groups": {
    --       "Lorem_1": {
    --         "last_nodata_ts": -12653992,
    --         "last_notified_ts": -66141067,
    --         "last_resolved_ts": 5643925,
    --         "last_triggered_ts": -6121593,
    --         "name": "dolore nulla i",
    --         "status": "OK"
    --       },
    --       "nisi_c43": {
    --         "last_nodata_ts": -66061060,
    --         "last_notified_ts": -86988012,
    --         "last_resolved_ts": -39919633,
    --         "last_triggered_ts": 13467862,
    --         "name": "Ut fugiat eiusmod anim",
    --         "status": "Ignored"
    --       },
    --       "minim_c": {
    --         "last_nodata_ts": 6509669,
    --         "last_notified_ts": 39348490,
    --         "last_resolved_ts": 13221088,
    --         "last_triggered_ts": 21889420,
    --         "name": "in velit Duis",
    --         "status": "Alert"
    --       }
    --     }
    --   },
    --   "tags": [
    --     "ex tempor",
    --     "enim veniam dolore"
    --   ]
    -- }

    DECLARE @json int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'type', 'query alert'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'query', 'avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'created', '1989-12-01T14:28:43.831Z'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'creator.email', 'officia sunt'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'creator.handle', 'pariatur'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'creator.name', 'aute do'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'deleted', '2020-10-30T20:46:24.520Z'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'id', -50675854
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'matching_downtimes[0].id', 1625
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'matching_downtimes[0].end', 1412792983
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'matching_downtimes[0].scope[0]', 'env:staging'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'matching_downtimes[0].start', 1412792983
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'matching_downtimes[1].id', 1625
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'matching_downtimes[1].end', 1412792983
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'matching_downtimes[1].scope[0]', 'env:staging'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'matching_downtimes[1].start', 1412792983
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'message', 'ullamco incididunt cupidatat'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'modified', '1981-03-27T05:04:03.098Z'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'multi', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'name', 'My monitor'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.aggregation.group_by', 'host'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.aggregation.metric', 'metrics.name'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.aggregation.type', 'count'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.device_ids[0]', 'mobile_small'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.device_ids[1]', 'chrome.tablet'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.enable_logs_sample', 0
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.enable_samples', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.escalation_message', 'none'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.evaluation_delay', -52819274
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.group_retention_duration', 'dolor Lorem qui'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.groupby_simple_monitor', 0
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.include_tags', 1
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.locked', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.min_failure_duration', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.min_location_failed', 1
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.new_group_delay', -94315945
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.new_host_delay', 300
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.no_data_timeframe', -86360342
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.notification_preset_name', 'show_all'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.notify_audit', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.notify_by[0]', 'labore dolore'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.notify_by[1]', 'deserunt commodo consectetur'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.notify_no_data', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.on_missing_data', 'resolve'
    EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'options.renotify_interval'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.renotify_occurrences', 56355858
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.renotify_statuses[0]', 'warn'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.renotify_statuses[1]', 'no data'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.require_full_window', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.scheduling_options.evaluation_window.day_starts', '04:00'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.scheduling_options.evaluation_window.hour_starts', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.scheduling_options.evaluation_window.month_starts', 1
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.silenced.non_6f_', 77287100
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.synthetics_check_id', 'culpa in laborum irure'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.threshold_windows.recovery_window', 'culpa cupidatat Lorem ut'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.threshold_windows.trigger_window', 'fugiat officia mollit esse quis'
    EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'options.thresholds.critical', '-44507487.0891542'
    EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'options.thresholds.critical_recovery', '94365870.17342958'
    EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'options.thresholds.ok', '26645340.31156695'
    EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'options.thresholds.unknown', '-32772943.396166816'
    EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'options.thresholds.warning', '75330874.10211122'
    EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'options.thresholds.warning_recovery', '30665996.226613894'
    EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'options.timeout_h'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].data_source', 'rum'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].compute.aggregation', 'avg'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.variables[0].compute.interval', 60000
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].compute.metric', '@duration'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].name', 'query_errors'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[0].facet', 'status'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.variables[0].group_by[0].limit', 10
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[0].sort.aggregation', 'avg'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[0].sort.metric', 'minim tempor i'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[0].sort.order', 'desc'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[1].facet', 'status'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.variables[0].group_by[1].limit', 10
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[1].sort.aggregation', 'avg'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[1].sort.metric', 'Ut fugiat officia'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].group_by[1].sort.order', 'desc'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].indexes[0]', 'days-3'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].indexes[1]', 'days-7'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[0].search.query', 'service:query'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].data_source', 'rum'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].compute.aggregation', 'avg'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.variables[1].compute.interval', 60000
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].compute.metric', '@duration'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].name', 'query_errors'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[0].facet', 'status'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.variables[1].group_by[0].limit', 10
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[0].sort.aggregation', 'avg'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[0].sort.metric', 'do velit'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[0].sort.order', 'desc'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[1].facet', 'status'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.variables[1].group_by[1].limit', 10
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[1].sort.aggregation', 'avg'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[1].sort.metric', 'amet proident anim in'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].group_by[1].sort.order', 'desc'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].indexes[0]', 'days-3'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].indexes[1]', 'days-7'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.variables[1].search.query', 'service:query'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'overall_state', 'Warn'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'priority', 1
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'restricted_roles[0]', 'enim qui cillum est'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'restricted_roles[1]', 'quis ut'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.Lorem_1.last_nodata_ts', -12653992
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.Lorem_1.last_notified_ts', -66141067
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.Lorem_1.last_resolved_ts', 5643925
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.Lorem_1.last_triggered_ts', -6121593
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'state.groups.Lorem_1.name', 'dolore nulla i'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'state.groups.Lorem_1.status', 'OK'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.nisi_c43.last_nodata_ts', -66061060
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.nisi_c43.last_notified_ts', -86988012
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.nisi_c43.last_resolved_ts', -39919633
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.nisi_c43.last_triggered_ts', 13467862
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'state.groups.nisi_c43.name', 'Ut fugiat eiusmod anim'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'state.groups.nisi_c43.status', 'Ignored'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.minim_c.last_nodata_ts', 6509669
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.minim_c.last_notified_ts', 39348490
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.minim_c.last_resolved_ts', 13221088
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'state.groups.minim_c.last_triggered_ts', 21889420
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'state.groups.minim_c.name', 'in velit Duis'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'state.groups.minim_c.status', 'Alert'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tags[0]', 'ex tempor'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tags[1]', 'enim veniam dolore'

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://api.app.ddog-gov.com/api/v1/monitor/:monitor_id/validate', 'application/json', @json
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @json
        RETURN
      END

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody

    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jResp OUT

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @resp

        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END
    EXEC @hr = sp_OADestroy @resp


    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @json
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Accept: application/json"
	-d '{
  "type": "query alert",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "created": "1989-12-01T14:28:43.831Z",
  "creator": {
    "email": "officia sunt",
    "handle": "pariatur",
    "name": "aute do"
  },
  "deleted": "2020-10-30T20:46:24.520Z",
  "id": -50675854,
  "matching_downtimes": [
    {
      "id": 1625,
      "end": 1412792983,
      "scope": [
        "env:staging"
      ],
      "start": 1412792983
    },
    {
      "id": 1625,
      "end": 1412792983,
      "scope": [
        "env:staging"
      ],
      "start": 1412792983
    }
  ],
  "message": "ullamco incididunt cupidatat",
  "modified": "1981-03-27T05:04:03.098Z",
  "multi": false,
  "name": "My monitor",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [
      "mobile_small",
      "chrome.tablet"
    ],
    "enable_logs_sample": false,
    "enable_samples": false,
    "escalation_message": "none",
    "evaluation_delay": -52819274,
    "group_retention_duration": "dolor Lorem qui",
    "groupby_simple_monitor": false,
    "include_tags": true,
    "locked": false,
    "min_failure_duration": 0,
    "min_location_failed": 1,
    "new_group_delay": -94315945,
    "new_host_delay": 300,
    "no_data_timeframe": -86360342,
    "notification_preset_name": "show_all",
    "notify_audit": false,
    "notify_by": [
      "labore dolore",
      "deserunt commodo consectetur"
    ],
    "notify_no_data": false,
    "on_missing_data": "resolve",
    "renotify_interval": null,
    "renotify_occurrences": 56355858,
    "renotify_statuses": [
      "warn",
      "no data"
    ],
    "require_full_window": false,
    "scheduling_options": {
      "evaluation_window": {
        "day_starts": "04:00",
        "hour_starts": 0,
        "month_starts": 1
      }
    },
    "silenced": {
      "non_6f_": 77287100
    },
    "synthetics_check_id": "culpa in laborum irure",
    "threshold_windows": {
      "recovery_window": "culpa cupidatat Lorem ut",
      "trigger_window": "fugiat officia mollit esse quis"
    },
    "thresholds": {
      "critical": -44507487.0891542,
      "critical_recovery": 94365870.17342958,
      "ok": 26645340.31156695,
      "unknown": -32772943.396166816,
      "warning": 75330874.10211122,
      "warning_recovery": 30665996.226613894
    },
    "timeout_h": null,
    "variables": [
      {
        "data_source": "rum",
        "compute": {
          "aggregation": "avg",
          "interval": 60000,
          "metric": "@duration"
        },
        "name": "query_errors",
        "group_by": [
          {
            "facet": "status",
            "limit": 10,
            "sort": {
              "aggregation": "avg",
              "metric": "minim tempor i",
              "order": "desc"
            }
          },
          {
            "facet": "status",
            "limit": 10,
            "sort": {
              "aggregation": "avg",
              "metric": "Ut fugiat officia",
              "order": "desc"
            }
          }
        ],
        "indexes": [
          "days-3",
          "days-7"
        ],
        "search": {
          "query": "service:query"
        }
      },
      {
        "data_source": "rum",
        "compute": {
          "aggregation": "avg",
          "interval": 60000,
          "metric": "@duration"
        },
        "name": "query_errors",
        "group_by": [
          {
            "facet": "status",
            "limit": 10,
            "sort": {
              "aggregation": "avg",
              "metric": "do velit",
              "order": "desc"
            }
          },
          {
            "facet": "status",
            "limit": 10,
            "sort": {
              "aggregation": "avg",
              "metric": "amet proident anim in",
              "order": "desc"
            }
          }
        ],
        "indexes": [
          "days-3",
          "days-7"
        ],
        "search": {
          "query": "service:query"
        }
      }
    ]
  },
  "overall_state": "Warn",
  "priority": 1,
  "restricted_roles": [
    "enim qui cillum est",
    "quis ut"
  ],
  "state": {
    "groups": {
      "Lorem_1": {
        "last_nodata_ts": -12653992,
        "last_notified_ts": -66141067,
        "last_resolved_ts": 5643925,
        "last_triggered_ts": -6121593,
        "name": "dolore nulla i",
        "status": "OK"
      },
      "nisi_c43": {
        "last_nodata_ts": -66061060,
        "last_notified_ts": -86988012,
        "last_resolved_ts": -39919633,
        "last_triggered_ts": 13467862,
        "name": "Ut fugiat eiusmod anim",
        "status": "Ignored"
      },
      "minim_c": {
        "last_nodata_ts": 6509669,
        "last_notified_ts": 39348490,
        "last_resolved_ts": 13221088,
        "last_triggered_ts": 21889420,
        "name": "in velit Duis",
        "status": "Alert"
      }
    }
  },
  "tags": [
    "ex tempor",
    "enim veniam dolore"
  ]
}'
https://api.app.ddog-gov.com/api/v1/monitor/:monitor_id/validate

Postman Collection Item JSON

{
  "name": "Validate an existing monitor",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"type\": \"query alert\",\n  \"query\": \"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\n  \"created\": \"1989-12-01T14:28:43.831Z\",\n  \"creator\": {\n    \"email\": \"officia sunt\",\n    \"handle\": \"pariatur\",\n    \"name\": \"aute do\"\n  },\n  \"deleted\": \"2020-10-30T20:46:24.520Z\",\n  \"id\": -50675854,\n  \"matching_downtimes\": [\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    },\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    }\n  ],\n  \"message\": \"ullamco incididunt cupidatat\",\n  \"modified\": \"1981-03-27T05:04:03.098Z\",\n  \"multi\": false,\n  \"name\": \"My monitor\",\n  \"options\": {\n    \"aggregation\": {\n      \"group_by\": \"host\",\n      \"metric\": \"metrics.name\",\n      \"type\": \"count\"\n    },\n    \"device_ids\": [\n      \"mobile_small\",\n      \"chrome.tablet\"\n    ],\n    \"enable_logs_sample\": false,\n    \"enable_samples\": false,\n    \"escalation_message\": \"none\",\n    \"evaluation_delay\": -52819274,\n    \"group_retention_duration\": \"dolor Lorem qui\",\n    \"groupby_simple_monitor\": false,\n    \"include_tags\": true,\n    \"locked\": false,\n    \"min_failure_duration\": 0,\n    \"min_location_failed\": 1,\n    \"new_group_delay\": -94315945,\n    \"new_host_delay\": 300,\n    \"no_data_timeframe\": -86360342,\n    \"notification_preset_name\": \"show_all\",\n    \"notify_audit\": false,\n    \"notify_by\": [\n      \"labore dolore\",\n      \"deserunt commodo consectetur\"\n    ],\n    \"notify_no_data\": false,\n    \"on_missing_data\": \"resolve\",\n    \"renotify_interval\": null,\n    \"renotify_occurrences\": 56355858,\n    \"renotify_statuses\": [\n      \"warn\",\n      \"no data\"\n    ],\n    \"require_full_window\": false,\n    \"scheduling_options\": {\n      \"evaluation_window\": {\n        \"day_starts\": \"04:00\",\n        \"hour_starts\": 0,\n        \"month_starts\": 1\n      }\n    },\n    \"silenced\": {\n      \"non_6f_\": 77287100\n    },\n    \"synthetics_check_id\": \"culpa in laborum irure\",\n    \"threshold_windows\": {\n      \"recovery_window\": \"culpa cupidatat Lorem ut\",\n      \"trigger_window\": \"fugiat officia mollit esse quis\"\n    },\n    \"thresholds\": {\n      \"critical\": -44507487.0891542,\n      \"critical_recovery\": 94365870.17342958,\n      \"ok\": 26645340.31156695,\n      \"unknown\": -32772943.396166816,\n      \"warning\": 75330874.10211122,\n      \"warning_recovery\": 30665996.226613894\n    },\n    \"timeout_h\": null,\n    \"variables\": [\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"minim tempor i\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"Ut fugiat officia\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      },\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"do velit\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"amet proident anim in\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      }\n    ]\n  },\n  \"overall_state\": \"Warn\",\n  \"priority\": 1,\n  \"restricted_roles\": [\n    \"enim qui cillum est\",\n    \"quis ut\"\n  ],\n  \"state\": {\n    \"groups\": {\n      \"Lorem_1\": {\n        \"last_nodata_ts\": -12653992,\n        \"last_notified_ts\": -66141067,\n        \"last_resolved_ts\": 5643925,\n        \"last_triggered_ts\": -6121593,\n        \"name\": \"dolore nulla i\",\n        \"status\": \"OK\"\n      },\n      \"nisi_c43\": {\n        \"last_nodata_ts\": -66061060,\n        \"last_notified_ts\": -86988012,\n        \"last_resolved_ts\": -39919633,\n        \"last_triggered_ts\": 13467862,\n        \"name\": \"Ut fugiat eiusmod anim\",\n        \"status\": \"Ignored\"\n      },\n      \"minim_c\": {\n        \"last_nodata_ts\": 6509669,\n        \"last_notified_ts\": 39348490,\n        \"last_resolved_ts\": 13221088,\n        \"last_triggered_ts\": 21889420,\n        \"name\": \"in velit Duis\",\n        \"status\": \"Alert\"\n      }\n    }\n  },\n  \"tags\": [\n    \"ex tempor\",\n    \"enim veniam dolore\"\n  ]\n}",
      "options": {
        "raw": {
          "headerFamily": "json",
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/api/v1/monitor/:monitor_id/validate",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "monitor",
        ":monitor_id",
        "validate"
      ],
      "variable": [
        {
          "key": "monitor_id",
          "value": "666486743"
        }
      ]
    },
    "description": "Validate the monitor provided in the request."
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\": \"query alert\",\n  \"query\": \"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\n  \"created\": \"1989-12-01T14:28:43.831Z\",\n  \"creator\": {\n    \"email\": \"officia sunt\",\n    \"handle\": \"pariatur\",\n    \"name\": \"aute do\"\n  },\n  \"deleted\": \"2020-10-30T20:46:24.520Z\",\n  \"id\": -50675854,\n  \"matching_downtimes\": [\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    },\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    }\n  ],\n  \"message\": \"ullamco incididunt cupidatat\",\n  \"modified\": \"1981-03-27T05:04:03.098Z\",\n  \"multi\": false,\n  \"name\": \"My monitor\",\n  \"options\": {\n    \"aggregation\": {\n      \"group_by\": \"host\",\n      \"metric\": \"metrics.name\",\n      \"type\": \"count\"\n    },\n    \"device_ids\": [\n      \"mobile_small\",\n      \"chrome.tablet\"\n    ],\n    \"enable_logs_sample\": false,\n    \"enable_samples\": false,\n    \"escalation_message\": \"none\",\n    \"evaluation_delay\": -52819274,\n    \"group_retention_duration\": \"dolor Lorem qui\",\n    \"groupby_simple_monitor\": false,\n    \"include_tags\": true,\n    \"locked\": false,\n    \"min_failure_duration\": 0,\n    \"min_location_failed\": 1,\n    \"new_group_delay\": -94315945,\n    \"new_host_delay\": 300,\n    \"no_data_timeframe\": -86360342,\n    \"notification_preset_name\": \"show_all\",\n    \"notify_audit\": false,\n    \"notify_by\": [\n      \"labore dolore\",\n      \"deserunt commodo consectetur\"\n    ],\n    \"notify_no_data\": false,\n    \"on_missing_data\": \"resolve\",\n    \"renotify_interval\": null,\n    \"renotify_occurrences\": 56355858,\n    \"renotify_statuses\": [\n      \"warn\",\n      \"no data\"\n    ],\n    \"require_full_window\": false,\n    \"scheduling_options\": {\n      \"evaluation_window\": {\n        \"day_starts\": \"04:00\",\n        \"hour_starts\": 0,\n        \"month_starts\": 1\n      }\n    },\n    \"silenced\": {\n      \"non_6f_\": 77287100\n    },\n    \"synthetics_check_id\": \"culpa in laborum irure\",\n    \"threshold_windows\": {\n      \"recovery_window\": \"culpa cupidatat Lorem ut\",\n      \"trigger_window\": \"fugiat officia mollit esse quis\"\n    },\n    \"thresholds\": {\n      \"critical\": -44507487.0891542,\n      \"critical_recovery\": 94365870.17342958,\n      \"ok\": 26645340.31156695,\n      \"unknown\": -32772943.396166816,\n      \"warning\": 75330874.10211122,\n      \"warning_recovery\": 30665996.226613894\n    },\n    \"timeout_h\": null,\n    \"variables\": [\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"minim tempor i\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"Ut fugiat officia\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      },\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"do velit\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"amet proident anim in\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      }\n    ]\n  },\n  \"overall_state\": \"Warn\",\n  \"priority\": 1,\n  \"restricted_roles\": [\n    \"enim qui cillum est\",\n    \"quis ut\"\n  ],\n  \"state\": {\n    \"groups\": {\n      \"Lorem_1\": {\n        \"last_nodata_ts\": -12653992,\n        \"last_notified_ts\": -66141067,\n        \"last_resolved_ts\": 5643925,\n        \"last_triggered_ts\": -6121593,\n        \"name\": \"dolore nulla i\",\n        \"status\": \"OK\"\n      },\n      \"nisi_c43\": {\n        \"last_nodata_ts\": -66061060,\n        \"last_notified_ts\": -86988012,\n        \"last_resolved_ts\": -39919633,\n        \"last_triggered_ts\": 13467862,\n        \"name\": \"Ut fugiat eiusmod anim\",\n        \"status\": \"Ignored\"\n      },\n      \"minim_c\": {\n        \"last_nodata_ts\": 6509669,\n        \"last_notified_ts\": 39348490,\n        \"last_resolved_ts\": 13221088,\n        \"last_triggered_ts\": 21889420,\n        \"name\": \"in velit Duis\",\n        \"status\": \"Alert\"\n      }\n    }\n  },\n  \"tags\": [\n    \"ex tempor\",\n    \"enim veniam dolore\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/monitor/:monitor_id/validate",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "monitor",
            ":monitor_id",
            "validate"
          ],
          "variable": [
            {
              "key": "monitor_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "name": "Invalid JSON",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\": \"query alert\",\n  \"query\": \"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\n  \"created\": \"1989-12-01T14:28:43.831Z\",\n  \"creator\": {\n    \"email\": \"officia sunt\",\n    \"handle\": \"pariatur\",\n    \"name\": \"aute do\"\n  },\n  \"deleted\": \"2020-10-30T20:46:24.520Z\",\n  \"id\": -50675854,\n  \"matching_downtimes\": [\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    },\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    }\n  ],\n  \"message\": \"ullamco incididunt cupidatat\",\n  \"modified\": \"1981-03-27T05:04:03.098Z\",\n  \"multi\": false,\n  \"name\": \"My monitor\",\n  \"options\": {\n    \"aggregation\": {\n      \"group_by\": \"host\",\n      \"metric\": \"metrics.name\",\n      \"type\": \"count\"\n    },\n    \"device_ids\": [\n      \"mobile_small\",\n      \"chrome.tablet\"\n    ],\n    \"enable_logs_sample\": false,\n    \"enable_samples\": false,\n    \"escalation_message\": \"none\",\n    \"evaluation_delay\": -52819274,\n    \"group_retention_duration\": \"dolor Lorem qui\",\n    \"groupby_simple_monitor\": false,\n    \"include_tags\": true,\n    \"locked\": false,\n    \"min_failure_duration\": 0,\n    \"min_location_failed\": 1,\n    \"new_group_delay\": -94315945,\n    \"new_host_delay\": 300,\n    \"no_data_timeframe\": -86360342,\n    \"notification_preset_name\": \"show_all\",\n    \"notify_audit\": false,\n    \"notify_by\": [\n      \"labore dolore\",\n      \"deserunt commodo consectetur\"\n    ],\n    \"notify_no_data\": false,\n    \"on_missing_data\": \"resolve\",\n    \"renotify_interval\": null,\n    \"renotify_occurrences\": 56355858,\n    \"renotify_statuses\": [\n      \"warn\",\n      \"no data\"\n    ],\n    \"require_full_window\": false,\n    \"scheduling_options\": {\n      \"evaluation_window\": {\n        \"day_starts\": \"04:00\",\n        \"hour_starts\": 0,\n        \"month_starts\": 1\n      }\n    },\n    \"silenced\": {\n      \"non_6f_\": 77287100\n    },\n    \"synthetics_check_id\": \"culpa in laborum irure\",\n    \"threshold_windows\": {\n      \"recovery_window\": \"culpa cupidatat Lorem ut\",\n      \"trigger_window\": \"fugiat officia mollit esse quis\"\n    },\n    \"thresholds\": {\n      \"critical\": -44507487.0891542,\n      \"critical_recovery\": 94365870.17342958,\n      \"ok\": 26645340.31156695,\n      \"unknown\": -32772943.396166816,\n      \"warning\": 75330874.10211122,\n      \"warning_recovery\": 30665996.226613894\n    },\n    \"timeout_h\": null,\n    \"variables\": [\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"minim tempor i\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"Ut fugiat officia\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      },\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"do velit\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"amet proident anim in\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      }\n    ]\n  },\n  \"overall_state\": \"Warn\",\n  \"priority\": 1,\n  \"restricted_roles\": [\n    \"enim qui cillum est\",\n    \"quis ut\"\n  ],\n  \"state\": {\n    \"groups\": {\n      \"Lorem_1\": {\n        \"last_nodata_ts\": -12653992,\n        \"last_notified_ts\": -66141067,\n        \"last_resolved_ts\": 5643925,\n        \"last_triggered_ts\": -6121593,\n        \"name\": \"dolore nulla i\",\n        \"status\": \"OK\"\n      },\n      \"nisi_c43\": {\n        \"last_nodata_ts\": -66061060,\n        \"last_notified_ts\": -86988012,\n        \"last_resolved_ts\": -39919633,\n        \"last_triggered_ts\": 13467862,\n        \"name\": \"Ut fugiat eiusmod anim\",\n        \"status\": \"Ignored\"\n      },\n      \"minim_c\": {\n        \"last_nodata_ts\": 6509669,\n        \"last_notified_ts\": 39348490,\n        \"last_resolved_ts\": 13221088,\n        \"last_triggered_ts\": 21889420,\n        \"name\": \"in velit Duis\",\n        \"status\": \"Alert\"\n      }\n    }\n  },\n  \"tags\": [\n    \"ex tempor\",\n    \"enim veniam dolore\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/monitor/:monitor_id/validate",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "monitor",
            ":monitor_id",
            "validate"
          ],
          "variable": [
            {
              "key": "monitor_id"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"Bad Request\",\n    \"Bad Request\"\n  ]\n}"
    },
    {
      "name": "Forbidden",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\": \"query alert\",\n  \"query\": \"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\n  \"created\": \"1989-12-01T14:28:43.831Z\",\n  \"creator\": {\n    \"email\": \"officia sunt\",\n    \"handle\": \"pariatur\",\n    \"name\": \"aute do\"\n  },\n  \"deleted\": \"2020-10-30T20:46:24.520Z\",\n  \"id\": -50675854,\n  \"matching_downtimes\": [\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    },\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    }\n  ],\n  \"message\": \"ullamco incididunt cupidatat\",\n  \"modified\": \"1981-03-27T05:04:03.098Z\",\n  \"multi\": false,\n  \"name\": \"My monitor\",\n  \"options\": {\n    \"aggregation\": {\n      \"group_by\": \"host\",\n      \"metric\": \"metrics.name\",\n      \"type\": \"count\"\n    },\n    \"device_ids\": [\n      \"mobile_small\",\n      \"chrome.tablet\"\n    ],\n    \"enable_logs_sample\": false,\n    \"enable_samples\": false,\n    \"escalation_message\": \"none\",\n    \"evaluation_delay\": -52819274,\n    \"group_retention_duration\": \"dolor Lorem qui\",\n    \"groupby_simple_monitor\": false,\n    \"include_tags\": true,\n    \"locked\": false,\n    \"min_failure_duration\": 0,\n    \"min_location_failed\": 1,\n    \"new_group_delay\": -94315945,\n    \"new_host_delay\": 300,\n    \"no_data_timeframe\": -86360342,\n    \"notification_preset_name\": \"show_all\",\n    \"notify_audit\": false,\n    \"notify_by\": [\n      \"labore dolore\",\n      \"deserunt commodo consectetur\"\n    ],\n    \"notify_no_data\": false,\n    \"on_missing_data\": \"resolve\",\n    \"renotify_interval\": null,\n    \"renotify_occurrences\": 56355858,\n    \"renotify_statuses\": [\n      \"warn\",\n      \"no data\"\n    ],\n    \"require_full_window\": false,\n    \"scheduling_options\": {\n      \"evaluation_window\": {\n        \"day_starts\": \"04:00\",\n        \"hour_starts\": 0,\n        \"month_starts\": 1\n      }\n    },\n    \"silenced\": {\n      \"non_6f_\": 77287100\n    },\n    \"synthetics_check_id\": \"culpa in laborum irure\",\n    \"threshold_windows\": {\n      \"recovery_window\": \"culpa cupidatat Lorem ut\",\n      \"trigger_window\": \"fugiat officia mollit esse quis\"\n    },\n    \"thresholds\": {\n      \"critical\": -44507487.0891542,\n      \"critical_recovery\": 94365870.17342958,\n      \"ok\": 26645340.31156695,\n      \"unknown\": -32772943.396166816,\n      \"warning\": 75330874.10211122,\n      \"warning_recovery\": 30665996.226613894\n    },\n    \"timeout_h\": null,\n    \"variables\": [\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"minim tempor i\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"Ut fugiat officia\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      },\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"do velit\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"amet proident anim in\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      }\n    ]\n  },\n  \"overall_state\": \"Warn\",\n  \"priority\": 1,\n  \"restricted_roles\": [\n    \"enim qui cillum est\",\n    \"quis ut\"\n  ],\n  \"state\": {\n    \"groups\": {\n      \"Lorem_1\": {\n        \"last_nodata_ts\": -12653992,\n        \"last_notified_ts\": -66141067,\n        \"last_resolved_ts\": 5643925,\n        \"last_triggered_ts\": -6121593,\n        \"name\": \"dolore nulla i\",\n        \"status\": \"OK\"\n      },\n      \"nisi_c43\": {\n        \"last_nodata_ts\": -66061060,\n        \"last_notified_ts\": -86988012,\n        \"last_resolved_ts\": -39919633,\n        \"last_triggered_ts\": 13467862,\n        \"name\": \"Ut fugiat eiusmod anim\",\n        \"status\": \"Ignored\"\n      },\n      \"minim_c\": {\n        \"last_nodata_ts\": 6509669,\n        \"last_notified_ts\": 39348490,\n        \"last_resolved_ts\": 13221088,\n        \"last_triggered_ts\": 21889420,\n        \"name\": \"in velit Duis\",\n        \"status\": \"Alert\"\n      }\n    }\n  },\n  \"tags\": [\n    \"ex tempor\",\n    \"enim veniam dolore\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/monitor/:monitor_id/validate",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "monitor",
            ":monitor_id",
            "validate"
          ],
          "variable": [
            {
              "key": "monitor_id"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"Bad Request\",\n    \"Bad Request\"\n  ]\n}"
    },
    {
      "name": "Too many requests",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"type\": \"query alert\",\n  \"query\": \"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\n  \"created\": \"1989-12-01T14:28:43.831Z\",\n  \"creator\": {\n    \"email\": \"officia sunt\",\n    \"handle\": \"pariatur\",\n    \"name\": \"aute do\"\n  },\n  \"deleted\": \"2020-10-30T20:46:24.520Z\",\n  \"id\": -50675854,\n  \"matching_downtimes\": [\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    },\n    {\n      \"id\": 1625,\n      \"end\": 1412792983,\n      \"scope\": [\n        \"env:staging\"\n      ],\n      \"start\": 1412792983\n    }\n  ],\n  \"message\": \"ullamco incididunt cupidatat\",\n  \"modified\": \"1981-03-27T05:04:03.098Z\",\n  \"multi\": false,\n  \"name\": \"My monitor\",\n  \"options\": {\n    \"aggregation\": {\n      \"group_by\": \"host\",\n      \"metric\": \"metrics.name\",\n      \"type\": \"count\"\n    },\n    \"device_ids\": [\n      \"mobile_small\",\n      \"chrome.tablet\"\n    ],\n    \"enable_logs_sample\": false,\n    \"enable_samples\": false,\n    \"escalation_message\": \"none\",\n    \"evaluation_delay\": -52819274,\n    \"group_retention_duration\": \"dolor Lorem qui\",\n    \"groupby_simple_monitor\": false,\n    \"include_tags\": true,\n    \"locked\": false,\n    \"min_failure_duration\": 0,\n    \"min_location_failed\": 1,\n    \"new_group_delay\": -94315945,\n    \"new_host_delay\": 300,\n    \"no_data_timeframe\": -86360342,\n    \"notification_preset_name\": \"show_all\",\n    \"notify_audit\": false,\n    \"notify_by\": [\n      \"labore dolore\",\n      \"deserunt commodo consectetur\"\n    ],\n    \"notify_no_data\": false,\n    \"on_missing_data\": \"resolve\",\n    \"renotify_interval\": null,\n    \"renotify_occurrences\": 56355858,\n    \"renotify_statuses\": [\n      \"warn\",\n      \"no data\"\n    ],\n    \"require_full_window\": false,\n    \"scheduling_options\": {\n      \"evaluation_window\": {\n        \"day_starts\": \"04:00\",\n        \"hour_starts\": 0,\n        \"month_starts\": 1\n      }\n    },\n    \"silenced\": {\n      \"non_6f_\": 77287100\n    },\n    \"synthetics_check_id\": \"culpa in laborum irure\",\n    \"threshold_windows\": {\n      \"recovery_window\": \"culpa cupidatat Lorem ut\",\n      \"trigger_window\": \"fugiat officia mollit esse quis\"\n    },\n    \"thresholds\": {\n      \"critical\": -44507487.0891542,\n      \"critical_recovery\": 94365870.17342958,\n      \"ok\": 26645340.31156695,\n      \"unknown\": -32772943.396166816,\n      \"warning\": 75330874.10211122,\n      \"warning_recovery\": 30665996.226613894\n    },\n    \"timeout_h\": null,\n    \"variables\": [\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"minim tempor i\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"Ut fugiat officia\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      },\n      {\n        \"data_source\": \"rum\",\n        \"compute\": {\n          \"aggregation\": \"avg\",\n          \"interval\": 60000,\n          \"metric\": \"@duration\"\n        },\n        \"name\": \"query_errors\",\n        \"group_by\": [\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"do velit\",\n              \"order\": \"desc\"\n            }\n          },\n          {\n            \"facet\": \"status\",\n            \"limit\": 10,\n            \"sort\": {\n              \"aggregation\": \"avg\",\n              \"metric\": \"amet proident anim in\",\n              \"order\": \"desc\"\n            }\n          }\n        ],\n        \"indexes\": [\n          \"days-3\",\n          \"days-7\"\n        ],\n        \"search\": {\n          \"query\": \"service:query\"\n        }\n      }\n    ]\n  },\n  \"overall_state\": \"Warn\",\n  \"priority\": 1,\n  \"restricted_roles\": [\n    \"enim qui cillum est\",\n    \"quis ut\"\n  ],\n  \"state\": {\n    \"groups\": {\n      \"Lorem_1\": {\n        \"last_nodata_ts\": -12653992,\n        \"last_notified_ts\": -66141067,\n        \"last_resolved_ts\": 5643925,\n        \"last_triggered_ts\": -6121593,\n        \"name\": \"dolore nulla i\",\n        \"status\": \"OK\"\n      },\n      \"nisi_c43\": {\n        \"last_nodata_ts\": -66061060,\n        \"last_notified_ts\": -86988012,\n        \"last_resolved_ts\": -39919633,\n        \"last_triggered_ts\": 13467862,\n        \"name\": \"Ut fugiat eiusmod anim\",\n        \"status\": \"Ignored\"\n      },\n      \"minim_c\": {\n        \"last_nodata_ts\": 6509669,\n        \"last_notified_ts\": 39348490,\n        \"last_resolved_ts\": 13221088,\n        \"last_triggered_ts\": 21889420,\n        \"name\": \"in velit Duis\",\n        \"status\": \"Alert\"\n      }\n    }\n  },\n  \"tags\": [\n    \"ex tempor\",\n    \"enim veniam dolore\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/monitor/:monitor_id/validate",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "monitor",
            ":monitor_id",
            "validate"
          ],
          "variable": [
            {
              "key": "monitor_id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"Bad Request\",\n    \"Bad Request\"\n  ]\n}"
    }
  ]
}