Chilkat Online Tools

SQL Server / Datadog API Collection / Edit an API test

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.

    -- {
    --   "name": "Example test name",
    --   "config": {
    --     "assertions": [
    --       {
    --         "operator": "lessThan",
    --         "target": 1000,
    --         "type": "responseTime"
    --       }
    --     ],
    --     "request": {
    --       "method": "GET",
    --       "url": "https://example.com"
    --     }
    --   },
    --   "locations": [
    --     "aws:eu-west-3"
    --   ],
    --   "options": {
    --     "accept_self_signed": true,
    --     "allow_insecure": true,
    --     "checkCertificateRevocation": true,
    --     "ci": {
    --       "executionRule": "non_blocking"
    --     },
    --     "device_ids": [
    --       "laptop_large",
    --       "laptop_large"
    --     ],
    --     "disableCors": false,
    --     "disableCsp": false,
    --     "follow_redirects": true,
    --     "httpVersion": "http1",
    --     "ignoreServerCertificateError": false,
    --     "initialNavigationTimeout": 87780679,
    --     "min_failure_duration": -32472759,
    --     "min_location_failed": -5806955,
    --     "monitor_name": "et deserunt ",
    --     "monitor_options": {
    --       "renotify_interval": 834
    --     },
    --     "monitor_priority": 3,
    --     "noScreenshot": false,
    --     "restricted_roles": [
    --       "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    --     ],
    --     "retry": {
    --       "count": -50657150,
    --       "interval": -91565669.0691471
    --     },
    --     "rumSettings": {
    --       "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    --       "clientTokenId": 12345,
    --       "isEnabled": true
    --     },
    --     "scheduling": {
    --       "timeframes": [
    --         {
    --           "day": 1,
    --           "from": "07:00",
    --           "to": "16:00"
    --         },
    --         {
    --           "day": 3,
    --           "from": "07:00",
    --           "to": "16:00"
    --         }
    --       ],
    --       "timezone": "America/New_York"
    --     },
    --     "tick_every": 384020
    --   },
    --   "type": "api",
    --   "message": "Notification message",
    --   "monitor_id": 12345678,
    --   "public_id": "123-abc-456",
    --   "status": "live",
    --   "subtype": "http",
    --   "tags": [
    --     "env:production"
    --   ]
    -- }

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

    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'name', 'Example test name'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'config.assertions[0].operator', 'lessThan'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'config.assertions[0].target', 1000
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'config.assertions[0].type', 'responseTime'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'config.request.method', 'GET'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'config.request.url', 'https://example.com'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'locations[0]', 'aws:eu-west-3'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.accept_self_signed', 1
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.allow_insecure', 1
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.checkCertificateRevocation', 1
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.ci.executionRule', 'non_blocking'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.device_ids[0]', 'laptop_large'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.device_ids[1]', 'laptop_large'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.disableCors', 0
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.disableCsp', 0
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.follow_redirects', 1
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.httpVersion', 'http1'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.ignoreServerCertificateError', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.initialNavigationTimeout', 87780679
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.min_failure_duration', -32472759
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.min_location_failed', -5806955
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.monitor_name', 'et deserunt '
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.monitor_options.renotify_interval', 834
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.monitor_priority', 3
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.noScreenshot', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.restricted_roles[0]', 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.retry.count', -50657150
    EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'options.retry.interval', '-91565669.0691471'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.rumSettings.applicationId', 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.rumSettings.clientTokenId', 12345
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'options.rumSettings.isEnabled', 1
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.scheduling.timeframes[0].day', 1
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.scheduling.timeframes[0].from', '07:00'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.scheduling.timeframes[0].to', '16:00'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.scheduling.timeframes[1].day', 3
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.scheduling.timeframes[1].from', '07:00'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.scheduling.timeframes[1].to', '16:00'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'options.scheduling.timezone', 'America/New_York'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'options.tick_every', 384020
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'type', 'api'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'message', 'Notification message'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'monitor_id', 12345678
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'public_id', '123-abc-456'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'status', 'live'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'subtype', 'http'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'tags[0]', 'env:production'

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

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

    EXEC sp_OAMethod @json, 'EmitSb', @success OUT, @sbRequestBody

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'PTextSb', @resp OUT, 'PUT', 'https://api.app.ddog-gov.com/api/v1/synthetics/tests/api/:public_id', @sbRequestBody, 'utf-8', 'application/json', 0, 0
    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
        EXEC @hr = sp_OADestroy @sbRequestBody
        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 @sbRequestBody
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END
    EXEC @hr = sp_OADestroy @resp

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- {
    --   "name": "Example test name",
    --   "config": {
    --     "assertions": [
    --       {
    --         "operator": "lessThan",
    --         "target": 1000,
    --         "type": "responseTime"
    --       }
    --     ],
    --     "request": {
    --       "method": "GET",
    --       "url": "https://example.com"
    --     }
    --   },
    --   "locations": [
    --     "aws:eu-west-3"
    --   ],
    --   "options": {
    --     "accept_self_signed": true,
    --     "allow_insecure": true,
    --     "checkCertificateRevocation": true,
    --     "ci": {
    --       "executionRule": "non_blocking"
    --     },
    --     "device_ids": [
    --       "laptop_large",
    --       "laptop_large"
    --     ],
    --     "disableCors": false,
    --     "disableCsp": false,
    --     "follow_redirects": true,
    --     "httpVersion": "http1",
    --     "ignoreServerCertificateError": false,
    --     "initialNavigationTimeout": 87780679,
    --     "min_failure_duration": -32472759,
    --     "min_location_failed": -5806955,
    --     "monitor_name": "et deserunt ",
    --     "monitor_options": {
    --       "renotify_interval": 834
    --     },
    --     "monitor_priority": 3,
    --     "noScreenshot": false,
    --     "restricted_roles": [
    --       "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    --     ],
    --     "retry": {
    --       "count": -50657150,
    --       "interval": -91565669.0691471
    --     },
    --     "rumSettings": {
    --       "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    --       "clientTokenId": 12345,
    --       "isEnabled": true
    --     },
    --     "scheduling": {
    --       "timeframes": [
    --         {
    --           "day": 1,
    --           "from": "07:00",
    --           "to": "16:00"
    --         },
    --         {
    --           "day": 3,
    --           "from": "07:00",
    --           "to": "16:00"
    --         }
    --       ],
    --       "timezone": "America/New_York"
    --     },
    --     "tick_every": 384020
    --   },
    --   "type": "api",
    --   "message": "Notification message",
    --   "monitor_id": 12345678,
    --   "public_id": "123-abc-456",
    --   "status": "live",
    --   "subtype": "http",
    --   "tags": [
    --     "env:production"
    --   ]
    -- }

    -- Sample code for parsing the JSON response...
    -- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    DECLARE @operator nvarchar(4000)

    DECLARE @target int

    DECLARE @strVal nvarchar(4000)

    DECLARE @day int

    DECLARE @from nvarchar(4000)

    DECLARE @v_to nvarchar(4000)

    DECLARE @name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'name'
    DECLARE @Method nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Method OUT, 'config.request.method'
    DECLARE @v_Url nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_Url OUT, 'config.request.url'
    DECLARE @Accept_self_signed int
    EXEC sp_OAMethod @jResp, 'BoolOf', @Accept_self_signed OUT, 'options.accept_self_signed'
    DECLARE @Allow_insecure int
    EXEC sp_OAMethod @jResp, 'BoolOf', @Allow_insecure OUT, 'options.allow_insecure'
    DECLARE @CheckCertificateRevocation int
    EXEC sp_OAMethod @jResp, 'BoolOf', @CheckCertificateRevocation OUT, 'options.checkCertificateRevocation'
    DECLARE @ExecutionRule nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ExecutionRule OUT, 'options.ci.executionRule'
    DECLARE @DisableCors int
    EXEC sp_OAMethod @jResp, 'BoolOf', @DisableCors OUT, 'options.disableCors'
    DECLARE @DisableCsp int
    EXEC sp_OAMethod @jResp, 'BoolOf', @DisableCsp OUT, 'options.disableCsp'
    DECLARE @Follow_redirects int
    EXEC sp_OAMethod @jResp, 'BoolOf', @Follow_redirects OUT, 'options.follow_redirects'
    DECLARE @HttpVersion nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @HttpVersion OUT, 'options.httpVersion'
    DECLARE @IgnoreServerCertificateError int
    EXEC sp_OAMethod @jResp, 'BoolOf', @IgnoreServerCertificateError OUT, 'options.ignoreServerCertificateError'
    DECLARE @InitialNavigationTimeout int
    EXEC sp_OAMethod @jResp, 'IntOf', @InitialNavigationTimeout OUT, 'options.initialNavigationTimeout'
    DECLARE @Min_failure_duration int
    EXEC sp_OAMethod @jResp, 'IntOf', @Min_failure_duration OUT, 'options.min_failure_duration'
    DECLARE @Min_location_failed int
    EXEC sp_OAMethod @jResp, 'IntOf', @Min_location_failed OUT, 'options.min_location_failed'
    DECLARE @Monitor_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Monitor_name OUT, 'options.monitor_name'
    DECLARE @Renotify_interval int
    EXEC sp_OAMethod @jResp, 'IntOf', @Renotify_interval OUT, 'options.monitor_options.renotify_interval'
    DECLARE @Monitor_priority int
    EXEC sp_OAMethod @jResp, 'IntOf', @Monitor_priority OUT, 'options.monitor_priority'
    DECLARE @NoScreenshot int
    EXEC sp_OAMethod @jResp, 'BoolOf', @NoScreenshot OUT, 'options.noScreenshot'
    DECLARE @Count int
    EXEC sp_OAMethod @jResp, 'IntOf', @Count OUT, 'options.retry.count'
    DECLARE @Interval nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Interval OUT, 'options.retry.interval'
    DECLARE @ApplicationId nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ApplicationId OUT, 'options.rumSettings.applicationId'
    DECLARE @ClientTokenId int
    EXEC sp_OAMethod @jResp, 'IntOf', @ClientTokenId OUT, 'options.rumSettings.clientTokenId'
    DECLARE @IsEnabled int
    EXEC sp_OAMethod @jResp, 'BoolOf', @IsEnabled OUT, 'options.rumSettings.isEnabled'
    DECLARE @Timezone nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Timezone OUT, 'options.scheduling.timezone'
    DECLARE @Tick_every int
    EXEC sp_OAMethod @jResp, 'IntOf', @Tick_every OUT, 'options.tick_every'
    DECLARE @v_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'type'
    DECLARE @message nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @message OUT, 'message'
    DECLARE @monitor_id int
    EXEC sp_OAMethod @jResp, 'IntOf', @monitor_id OUT, 'monitor_id'
    DECLARE @public_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @public_id OUT, 'public_id'
    DECLARE @status nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'status'
    DECLARE @subtype nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @subtype OUT, 'subtype'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'config.assertions'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @operator OUT, 'config.assertions[i].operator'
        EXEC sp_OAMethod @jResp, 'IntOf', @target OUT, 'config.assertions[i].target'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'config.assertions[i].type'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'locations'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'locations[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'options.device_ids'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'options.device_ids[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'options.restricted_roles'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'options.restricted_roles[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'options.scheduling.timeframes'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'IntOf', @day OUT, 'options.scheduling.timeframes[i].day'
        EXEC sp_OAMethod @jResp, 'StringOf', @from OUT, 'options.scheduling.timeframes[i].from'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_to OUT, 'options.scheduling.timeframes[i].to'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'tags'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'tags[i]'
        SELECT @i = @i + 1
      END

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


END
GO

Curl Command

curl -X PUT
	-H "Content-Type: application/json"
	-H "Accept: application/json"
	-d '{
  "name": "Example test name",
  "config": {
    "assertions": [
      {
        "operator": "lessThan",
        "target": 1000,
        "type": "responseTime"
      }
    ],
    "request": {
      "method": "GET",
      "url": "https://example.com"
    }
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "options": {
    "accept_self_signed": true,
    "allow_insecure": true,
    "checkCertificateRevocation": true,
    "ci": {
      "executionRule": "non_blocking"
    },
    "device_ids": [
      "laptop_large",
      "laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "follow_redirects": true,
    "httpVersion": "http1",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": 87780679,
    "min_failure_duration": -32472759,
    "min_location_failed": -5806955,
    "monitor_name": "et deserunt ",
    "monitor_options": {
      "renotify_interval": 834
    },
    "monitor_priority": 3,
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": -50657150,
      "interval": -91565669.0691471
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        },
        {
          "day": 3,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": 384020
  },
  "type": "api",
  "message": "Notification message",
  "monitor_id": 12345678,
  "public_id": "123-abc-456",
  "status": "live",
  "subtype": "http",
  "tags": [
    "env:production"
  ]
}'
https://api.app.ddog-gov.com/api/v1/synthetics/tests/api/:public_id

Postman Collection Item JSON

{
  "name": "Edit an API test",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"name\": \"Example test name\",\n  \"config\": {\n    \"assertions\": [\n      {\n        \"operator\": \"lessThan\",\n        \"target\": 1000,\n        \"type\": \"responseTime\"\n      }\n    ],\n    \"request\": {\n      \"method\": \"GET\",\n      \"url\": \"https://example.com\"\n    }\n  },\n  \"locations\": [\n    \"aws:eu-west-3\"\n  ],\n  \"options\": {\n    \"accept_self_signed\": true,\n    \"allow_insecure\": true,\n    \"checkCertificateRevocation\": true,\n    \"ci\": {\n      \"executionRule\": \"non_blocking\"\n    },\n    \"device_ids\": [\n      \"laptop_large\",\n      \"laptop_large\"\n    ],\n    \"disableCors\": false,\n    \"disableCsp\": false,\n    \"follow_redirects\": true,\n    \"httpVersion\": \"http1\",\n    \"ignoreServerCertificateError\": false,\n    \"initialNavigationTimeout\": 87780679,\n    \"min_failure_duration\": -32472759,\n    \"min_location_failed\": -5806955,\n    \"monitor_name\": \"et deserunt \",\n    \"monitor_options\": {\n      \"renotify_interval\": 834\n    },\n    \"monitor_priority\": 3,\n    \"noScreenshot\": false,\n    \"restricted_roles\": [\n      \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n    ],\n    \"retry\": {\n      \"count\": -50657150,\n      \"interval\": -91565669.0691471\n    },\n    \"rumSettings\": {\n      \"applicationId\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n      \"clientTokenId\": 12345,\n      \"isEnabled\": true\n    },\n    \"scheduling\": {\n      \"timeframes\": [\n        {\n          \"day\": 1,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        },\n        {\n          \"day\": 3,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        }\n      ],\n      \"timezone\": \"America/New_York\"\n    },\n    \"tick_every\": 384020\n  },\n  \"type\": \"api\",\n  \"message\": \"Notification message\",\n  \"monitor_id\": 12345678,\n  \"public_id\": \"123-abc-456\",\n  \"status\": \"live\",\n  \"subtype\": \"http\",\n  \"tags\": [\n    \"env:production\"\n  ]\n}",
      "options": {
        "raw": {
          "headerFamily": "json",
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/api/v1/synthetics/tests/api/:public_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "synthetics",
        "tests",
        "api",
        ":public_id"
      ],
      "variable": [
        {
          "key": "public_id",
          "value": "tempor Ut sed velit"
        }
      ]
    },
    "description": "Edit the configuration of a Synthetic API test."
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "PUT",
        "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  \"name\": \"Example test name\",\n  \"config\": {\n    \"assertions\": [\n      {\n        \"operator\": \"lessThan\",\n        \"target\": 1000,\n        \"type\": \"responseTime\"\n      }\n    ],\n    \"request\": {\n      \"method\": \"GET\",\n      \"url\": \"https://example.com\"\n    }\n  },\n  \"locations\": [\n    \"aws:eu-west-3\"\n  ],\n  \"options\": {\n    \"accept_self_signed\": true,\n    \"allow_insecure\": true,\n    \"checkCertificateRevocation\": true,\n    \"ci\": {\n      \"executionRule\": \"non_blocking\"\n    },\n    \"device_ids\": [\n      \"laptop_large\",\n      \"laptop_large\"\n    ],\n    \"disableCors\": false,\n    \"disableCsp\": false,\n    \"follow_redirects\": true,\n    \"httpVersion\": \"http1\",\n    \"ignoreServerCertificateError\": false,\n    \"initialNavigationTimeout\": 87780679,\n    \"min_failure_duration\": -32472759,\n    \"min_location_failed\": -5806955,\n    \"monitor_name\": \"et deserunt \",\n    \"monitor_options\": {\n      \"renotify_interval\": 834\n    },\n    \"monitor_priority\": 3,\n    \"noScreenshot\": false,\n    \"restricted_roles\": [\n      \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n    ],\n    \"retry\": {\n      \"count\": -50657150,\n      \"interval\": -91565669.0691471\n    },\n    \"rumSettings\": {\n      \"applicationId\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n      \"clientTokenId\": 12345,\n      \"isEnabled\": true\n    },\n    \"scheduling\": {\n      \"timeframes\": [\n        {\n          \"day\": 1,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        },\n        {\n          \"day\": 3,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        }\n      ],\n      \"timezone\": \"America/New_York\"\n    },\n    \"tick_every\": 384020\n  },\n  \"type\": \"api\",\n  \"message\": \"Notification message\",\n  \"monitor_id\": 12345678,\n  \"public_id\": \"123-abc-456\",\n  \"status\": \"live\",\n  \"subtype\": \"http\",\n  \"tags\": [\n    \"env:production\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/synthetics/tests/api/:public_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "api",
            ":public_id"
          ],
          "variable": [
            {
              "key": "public_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"name\": \"Example test name\",\n  \"config\": {\n    \"assertions\": [\n      {\n        \"operator\": \"lessThan\",\n        \"target\": 1000,\n        \"type\": \"responseTime\"\n      }\n    ],\n    \"request\": {\n      \"method\": \"GET\",\n      \"url\": \"https://example.com\"\n    }\n  },\n  \"locations\": [\n    \"aws:eu-west-3\"\n  ],\n  \"options\": {\n    \"accept_self_signed\": true,\n    \"allow_insecure\": true,\n    \"checkCertificateRevocation\": true,\n    \"ci\": {\n      \"executionRule\": \"non_blocking\"\n    },\n    \"device_ids\": [\n      \"laptop_large\",\n      \"laptop_large\"\n    ],\n    \"disableCors\": false,\n    \"disableCsp\": false,\n    \"follow_redirects\": true,\n    \"httpVersion\": \"http1\",\n    \"ignoreServerCertificateError\": false,\n    \"initialNavigationTimeout\": 87780679,\n    \"min_failure_duration\": -32472759,\n    \"min_location_failed\": -5806955,\n    \"monitor_name\": \"et deserunt \",\n    \"monitor_options\": {\n      \"renotify_interval\": 834\n    },\n    \"monitor_priority\": 3,\n    \"noScreenshot\": false,\n    \"restricted_roles\": [\n      \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n    ],\n    \"retry\": {\n      \"count\": -50657150,\n      \"interval\": -91565669.0691471\n    },\n    \"rumSettings\": {\n      \"applicationId\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n      \"clientTokenId\": 12345,\n      \"isEnabled\": true\n    },\n    \"scheduling\": {\n      \"timeframes\": [\n        {\n          \"day\": 1,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        },\n        {\n          \"day\": 3,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        }\n      ],\n      \"timezone\": \"America/New_York\"\n    },\n    \"tick_every\": 384020\n  },\n  \"type\": \"api\",\n  \"message\": \"Notification message\",\n  \"monitor_id\": 12345678,\n  \"public_id\": \"123-abc-456\",\n  \"status\": \"live\",\n  \"subtype\": \"http\",\n  \"tags\": [\n    \"env:production\"\n  ]\n}"
    },
    {
      "name": "- JSON format is wrong\n- Updating sub-type is forbidden",
      "originalRequest": {
        "method": "PUT",
        "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  \"name\": \"Example test name\",\n  \"config\": {\n    \"assertions\": [\n      {\n        \"operator\": \"lessThan\",\n        \"target\": 1000,\n        \"type\": \"responseTime\"\n      }\n    ],\n    \"request\": {\n      \"method\": \"GET\",\n      \"url\": \"https://example.com\"\n    }\n  },\n  \"locations\": [\n    \"aws:eu-west-3\"\n  ],\n  \"options\": {\n    \"accept_self_signed\": true,\n    \"allow_insecure\": true,\n    \"checkCertificateRevocation\": true,\n    \"ci\": {\n      \"executionRule\": \"non_blocking\"\n    },\n    \"device_ids\": [\n      \"laptop_large\",\n      \"laptop_large\"\n    ],\n    \"disableCors\": false,\n    \"disableCsp\": false,\n    \"follow_redirects\": true,\n    \"httpVersion\": \"http1\",\n    \"ignoreServerCertificateError\": false,\n    \"initialNavigationTimeout\": 87780679,\n    \"min_failure_duration\": -32472759,\n    \"min_location_failed\": -5806955,\n    \"monitor_name\": \"et deserunt \",\n    \"monitor_options\": {\n      \"renotify_interval\": 834\n    },\n    \"monitor_priority\": 3,\n    \"noScreenshot\": false,\n    \"restricted_roles\": [\n      \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n    ],\n    \"retry\": {\n      \"count\": -50657150,\n      \"interval\": -91565669.0691471\n    },\n    \"rumSettings\": {\n      \"applicationId\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n      \"clientTokenId\": 12345,\n      \"isEnabled\": true\n    },\n    \"scheduling\": {\n      \"timeframes\": [\n        {\n          \"day\": 1,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        },\n        {\n          \"day\": 3,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        }\n      ],\n      \"timezone\": \"America/New_York\"\n    },\n    \"tick_every\": 384020\n  },\n  \"type\": \"api\",\n  \"message\": \"Notification message\",\n  \"monitor_id\": 12345678,\n  \"public_id\": \"123-abc-456\",\n  \"status\": \"live\",\n  \"subtype\": \"http\",\n  \"tags\": [\n    \"env:production\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/synthetics/tests/api/:public_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "api",
            ":public_id"
          ],
          "variable": [
            {
              "key": "public_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": "PUT",
        "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  \"name\": \"Example test name\",\n  \"config\": {\n    \"assertions\": [\n      {\n        \"operator\": \"lessThan\",\n        \"target\": 1000,\n        \"type\": \"responseTime\"\n      }\n    ],\n    \"request\": {\n      \"method\": \"GET\",\n      \"url\": \"https://example.com\"\n    }\n  },\n  \"locations\": [\n    \"aws:eu-west-3\"\n  ],\n  \"options\": {\n    \"accept_self_signed\": true,\n    \"allow_insecure\": true,\n    \"checkCertificateRevocation\": true,\n    \"ci\": {\n      \"executionRule\": \"non_blocking\"\n    },\n    \"device_ids\": [\n      \"laptop_large\",\n      \"laptop_large\"\n    ],\n    \"disableCors\": false,\n    \"disableCsp\": false,\n    \"follow_redirects\": true,\n    \"httpVersion\": \"http1\",\n    \"ignoreServerCertificateError\": false,\n    \"initialNavigationTimeout\": 87780679,\n    \"min_failure_duration\": -32472759,\n    \"min_location_failed\": -5806955,\n    \"monitor_name\": \"et deserunt \",\n    \"monitor_options\": {\n      \"renotify_interval\": 834\n    },\n    \"monitor_priority\": 3,\n    \"noScreenshot\": false,\n    \"restricted_roles\": [\n      \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n    ],\n    \"retry\": {\n      \"count\": -50657150,\n      \"interval\": -91565669.0691471\n    },\n    \"rumSettings\": {\n      \"applicationId\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n      \"clientTokenId\": 12345,\n      \"isEnabled\": true\n    },\n    \"scheduling\": {\n      \"timeframes\": [\n        {\n          \"day\": 1,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        },\n        {\n          \"day\": 3,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        }\n      ],\n      \"timezone\": \"America/New_York\"\n    },\n    \"tick_every\": 384020\n  },\n  \"type\": \"api\",\n  \"message\": \"Notification message\",\n  \"monitor_id\": 12345678,\n  \"public_id\": \"123-abc-456\",\n  \"status\": \"live\",\n  \"subtype\": \"http\",\n  \"tags\": [\n    \"env:production\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/synthetics/tests/api/:public_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "api",
            ":public_id"
          ],
          "variable": [
            {
              "key": "public_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": "- Synthetic Monitoring is not activated for the user\n- Test is not owned by the user\n- Test can't be found",
      "originalRequest": {
        "method": "PUT",
        "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  \"name\": \"Example test name\",\n  \"config\": {\n    \"assertions\": [\n      {\n        \"operator\": \"lessThan\",\n        \"target\": 1000,\n        \"type\": \"responseTime\"\n      }\n    ],\n    \"request\": {\n      \"method\": \"GET\",\n      \"url\": \"https://example.com\"\n    }\n  },\n  \"locations\": [\n    \"aws:eu-west-3\"\n  ],\n  \"options\": {\n    \"accept_self_signed\": true,\n    \"allow_insecure\": true,\n    \"checkCertificateRevocation\": true,\n    \"ci\": {\n      \"executionRule\": \"non_blocking\"\n    },\n    \"device_ids\": [\n      \"laptop_large\",\n      \"laptop_large\"\n    ],\n    \"disableCors\": false,\n    \"disableCsp\": false,\n    \"follow_redirects\": true,\n    \"httpVersion\": \"http1\",\n    \"ignoreServerCertificateError\": false,\n    \"initialNavigationTimeout\": 87780679,\n    \"min_failure_duration\": -32472759,\n    \"min_location_failed\": -5806955,\n    \"monitor_name\": \"et deserunt \",\n    \"monitor_options\": {\n      \"renotify_interval\": 834\n    },\n    \"monitor_priority\": 3,\n    \"noScreenshot\": false,\n    \"restricted_roles\": [\n      \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n    ],\n    \"retry\": {\n      \"count\": -50657150,\n      \"interval\": -91565669.0691471\n    },\n    \"rumSettings\": {\n      \"applicationId\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n      \"clientTokenId\": 12345,\n      \"isEnabled\": true\n    },\n    \"scheduling\": {\n      \"timeframes\": [\n        {\n          \"day\": 1,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        },\n        {\n          \"day\": 3,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        }\n      ],\n      \"timezone\": \"America/New_York\"\n    },\n    \"tick_every\": 384020\n  },\n  \"type\": \"api\",\n  \"message\": \"Notification message\",\n  \"monitor_id\": 12345678,\n  \"public_id\": \"123-abc-456\",\n  \"status\": \"live\",\n  \"subtype\": \"http\",\n  \"tags\": [\n    \"env:production\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/synthetics/tests/api/:public_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "api",
            ":public_id"
          ],
          "variable": [
            {
              "key": "public_id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_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": "PUT",
        "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  \"name\": \"Example test name\",\n  \"config\": {\n    \"assertions\": [\n      {\n        \"operator\": \"lessThan\",\n        \"target\": 1000,\n        \"type\": \"responseTime\"\n      }\n    ],\n    \"request\": {\n      \"method\": \"GET\",\n      \"url\": \"https://example.com\"\n    }\n  },\n  \"locations\": [\n    \"aws:eu-west-3\"\n  ],\n  \"options\": {\n    \"accept_self_signed\": true,\n    \"allow_insecure\": true,\n    \"checkCertificateRevocation\": true,\n    \"ci\": {\n      \"executionRule\": \"non_blocking\"\n    },\n    \"device_ids\": [\n      \"laptop_large\",\n      \"laptop_large\"\n    ],\n    \"disableCors\": false,\n    \"disableCsp\": false,\n    \"follow_redirects\": true,\n    \"httpVersion\": \"http1\",\n    \"ignoreServerCertificateError\": false,\n    \"initialNavigationTimeout\": 87780679,\n    \"min_failure_duration\": -32472759,\n    \"min_location_failed\": -5806955,\n    \"monitor_name\": \"et deserunt \",\n    \"monitor_options\": {\n      \"renotify_interval\": 834\n    },\n    \"monitor_priority\": 3,\n    \"noScreenshot\": false,\n    \"restricted_roles\": [\n      \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n    ],\n    \"retry\": {\n      \"count\": -50657150,\n      \"interval\": -91565669.0691471\n    },\n    \"rumSettings\": {\n      \"applicationId\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n      \"clientTokenId\": 12345,\n      \"isEnabled\": true\n    },\n    \"scheduling\": {\n      \"timeframes\": [\n        {\n          \"day\": 1,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        },\n        {\n          \"day\": 3,\n          \"from\": \"07:00\",\n          \"to\": \"16:00\"\n        }\n      ],\n      \"timezone\": \"America/New_York\"\n    },\n    \"tick_every\": 384020\n  },\n  \"type\": \"api\",\n  \"message\": \"Notification message\",\n  \"monitor_id\": 12345678,\n  \"public_id\": \"123-abc-456\",\n  \"status\": \"live\",\n  \"subtype\": \"http\",\n  \"tags\": [\n    \"env:production\"\n  ]\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/synthetics/tests/api/:public_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "api",
            ":public_id"
          ],
          "variable": [
            {
              "key": "public_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}"
    }
  ]
}