Chilkat Online Tools

Unicode C++ / Datadog API Collection / Schedule a downtime

Back to Collection Items

void ChilkatSample(void)
    {
    json.UpdateString(L"data.type",L"downtime");    json.UpdateString(L"data.attributes.scope",L"<string>");    json.UpdateString(L"data.attributes.monitor_identifier.monitor_id",L"<long>");    json.UpdateString(L"data.attributes.display_timezone",L"UTC");    json.UpdateString(L"data.attributes.message",L"<string>");    json.UpdateString(L"data.attributes.mute_first_recovery_notification",L"<boolean>");    json.UpdateString(L"data.attributes.notify_end_states[0]",L"warn");    json.UpdateString(L"data.attributes.notify_end_states[1]",L"warn");    json.UpdateString(L"data.attributes.notify_end_types[0]",L"expired");    json.UpdateString(L"data.attributes.notify_end_types[1]",L"expired");    json.UpdateString(L"data.attributes.schedule.recurrences[0].duration",L"<string>");    json.UpdateString(L"data.attributes.schedule.recurrences[0].rrule",L"<string>");    json.UpdateString(L"data.attributes.schedule.recurrences[0].start",L"<string>");    json.UpdateString(L"data.attributes.schedule.recurrences[1].duration",L"<string>");    json.UpdateString(L"data.attributes.schedule.recurrences[1].rrule",L"<string>");    json.UpdateString(L"data.attributes.schedule.recurrences[1].start",L"<string>");    json.UpdateString(L"data.attributes.schedule.timezone",L"UTC");    resp->GetBodySb(sbResponseBody);    jResp.LoadSb(sbResponseBody);    jResp.put_EmitCompact(false);    DataId = jResp.stringOf(L"data.relationships.monitor.data.id");    jResp.put_I(i);    strVal = jResp.stringOf(L"data.attributes.notify_end_states[i]");    i = i + 1;    i = 0;    count_i = jResp.SizeOfArray(L"data.attributes.notify_end_types");    jResp.put_I(i);    strVal = jResp.stringOf(L"data.attributes.notify_end_types[i]");    i = i + 1;    i = 0;    count_i = jResp.SizeOfArray(L"data.attributes.schedule.recurrences");    jResp.put_I(i);    duration = jResp.stringOf(L"data.attributes.schedule.recurrences[i].duration");    rrule = jResp.stringOf(L"data.attributes.schedule.recurrences[i].rrule");    start = jResp.stringOf(L"data.attributes.schedule.recurrences[i].start");    i = i + 1;    i = 0;    count_i = jResp.SizeOfArray(L"included");    jResp.put_I(i);    Created_at = jResp.stringOf(L"included[i].attributes.created_at");    Disabled = jResp.stringOf(L"included[i].attributes.disabled");    v_Email = jResp.stringOf(L"included[i].attributes.email");    Handle = jResp.stringOf(L"included[i].attributes.handle");    Icon = jResp.stringOf(L"included[i].attributes.icon");    Modified_at = jResp.stringOf(L"included[i].attributes.modified_at");    Name = jResp.stringOf(L"included[i].attributes.name");    Service_account = jResp.stringOf(L"included[i].attributes.service_account");    attributesStatus = jResp.stringOf(L"included[i].attributes.status");    Title = jResp.stringOf(L"included[i].attributes.title");    Verified = jResp.stringOf(L"included[i].attributes.verified");    id = jResp.stringOf(L"included[i].id");    DataId = jResp.stringOf(L"included[i].relationships.org.data.id");    DataType = jResp.stringOf(L"included[i].relationships.org.data.type");    v_type = jResp.stringOf(L"included[i].type");    j = 0;    count_j = jResp.SizeOfArray(L"included[i].relationships.other_orgs.data");    jResp.put_J(j);    id = jResp.stringOf(L"included[i].relationships.other_orgs.data[j].id");    v_type = jResp.stringOf(L"included[i].relationships.other_orgs.data[j].type");    j = j + 1;    j = 0;    count_j = jResp.SizeOfArray(L"included[i].relationships.other_users.data");    jResp.put_J(j);    id = jResp.stringOf(L"included[i].relationships.other_users.data[j].id");    v_type = jResp.stringOf(L"included[i].relationships.other_users.data[j].type");    j = j + 1;    j = 0;    count_j = jResp.SizeOfArray(L"included[i].relationships.roles.data");    jResp.put_J(j);    id = jResp.stringOf(L"included[i].relationships.roles.data[j].id");    v_type = jResp.stringOf(L"included[i].relationships.roles.data[j].type");    j = j + 1;    i = i + 1;
    }

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Accept: application/json"
	-d '{
  "data": {
    "type": "downtime",
    "attributes": {
      "scope": "<string>",
      "monitor_identifier": {
        "monitor_id": "<long>"
      },
      "display_timezone": "UTC",
      "message": "<string>",
      "mute_first_recovery_notification": "<boolean>",
      "notify_end_states": [
        "warn",
        "warn"
      ],
      "notify_end_types": [
        "expired",
        "expired"
      ],
      "schedule": {
        "recurrences": [
          {
            "duration": "<string>",
            "rrule": "<string>",
            "start": "<string>"
          },
          {
            "duration": "<string>",
            "rrule": "<string>",
            "start": "<string>"
          }
        ],
        "timezone": "UTC"
      }
    }
  }
}'
https://api.app.ddog-gov.com/api/v2/downtime

Postman Collection Item JSON

{
  "name": "Schedule a downtime",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"data\": {\n    \"type\": \"downtime\",\n    \"attributes\": {\n      \"scope\": \"<string>\",\n      \"monitor_identifier\": {\n        \"monitor_id\": \"<long>\"\n      },\n      \"display_timezone\": \"UTC\",\n      \"message\": \"<string>\",\n      \"mute_first_recovery_notification\": \"<boolean>\",\n      \"notify_end_states\": [\n        \"warn\",\n        \"warn\"\n      ],\n      \"notify_end_types\": [\n        \"expired\",\n        \"expired\"\n      ],\n      \"schedule\": {\n        \"recurrences\": [\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          },\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          }\n        ],\n        \"timezone\": \"UTC\"\n      }\n    }\n  }\n}",
      "options": {
        "raw": {
          "headerFamily": "json",
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/api/v2/downtime",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "downtime"
      ]
    },
    "description": "Schedule a downtime."
  },
  "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  \"data\": {\n    \"type\": \"downtime\",\n    \"attributes\": {\n      \"scope\": \"<string>\",\n      \"monitor_identifier\": {\n        \"monitor_id\": \"<long>\"\n      },\n      \"display_timezone\": \"UTC\",\n      \"message\": \"<string>\",\n      \"mute_first_recovery_notification\": \"<boolean>\",\n      \"notify_end_states\": [\n        \"warn\",\n        \"warn\"\n      ],\n      \"notify_end_types\": [\n        \"expired\",\n        \"expired\"\n      ],\n      \"schedule\": {\n        \"recurrences\": [\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          },\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          }\n        ],\n        \"timezone\": \"UTC\"\n      }\n    }\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/downtime",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "downtime"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"data\": {\n    \"attributes\": {\n      \"canceled\": \"<dateTime>\",\n      \"created\": \"<dateTime>\",\n      \"display_timezone\": \"UTC\",\n      \"message\": \"<string>\",\n      \"modified\": \"<dateTime>\",\n      \"monitor_identifier\": {\n        \"monitor_id\": \"<long>\"\n      },\n      \"mute_first_recovery_notification\": \"<boolean>\",\n      \"notify_end_states\": [\n        \"alert\",\n        \"alert\"\n      ],\n      \"notify_end_types\": [\n        \"canceled\",\n        \"expired\"\n      ],\n      \"schedule\": {\n        \"recurrences\": [\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          }\n        ],\n        \"current_downtime\": {\n          \"end\": \"<dateTime>\",\n          \"start\": \"<dateTime>\"\n        },\n        \"timezone\": \"UTC\"\n      },\n      \"scope\": \"<string>\",\n      \"status\": \"scheduled\"\n    },\n    \"id\": \"<string>\",\n    \"relationships\": {\n      \"created_by\": {\n        \"data\": {\n          \"id\": \"<string>\",\n          \"type\": \"users\"\n        }\n      },\n      \"monitor\": {\n        \"data\": {\n          \"id\": \"<string>\",\n          \"type\": \"monitors\"\n        }\n      }\n    },\n    \"type\": \"downtime\"\n  },\n  \"included\": [\n    {\n      \"attributes\": {\n        \"created_at\": \"<dateTime>\",\n        \"disabled\": \"<boolean>\",\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"icon\": \"<string>\",\n        \"modified_at\": \"<dateTime>\",\n        \"name\": \"<string>\",\n        \"service_account\": \"<boolean>\",\n        \"status\": \"<string>\",\n        \"title\": \"<string>\",\n        \"verified\": \"<boolean>\"\n      },\n      \"id\": \"<string>\",\n      \"relationships\": {\n        \"org\": {\n          \"data\": {\n            \"id\": \"<string>\",\n            \"type\": \"orgs\"\n          }\n        },\n        \"other_orgs\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            }\n          ]\n        },\n        \"other_users\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            }\n          ]\n        },\n        \"roles\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            }\n          ]\n        }\n      },\n      \"type\": \"users\"\n    },\n    {\n      \"attributes\": {\n        \"created_at\": \"<dateTime>\",\n        \"disabled\": \"<boolean>\",\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"icon\": \"<string>\",\n        \"modified_at\": \"<dateTime>\",\n        \"name\": \"<string>\",\n        \"service_account\": \"<boolean>\",\n        \"status\": \"<string>\",\n        \"title\": \"<string>\",\n        \"verified\": \"<boolean>\"\n      },\n      \"id\": \"<string>\",\n      \"relationships\": {\n        \"org\": {\n          \"data\": {\n            \"id\": \"<string>\",\n            \"type\": \"orgs\"\n          }\n        },\n        \"other_orgs\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            }\n          ]\n        },\n        \"other_users\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            }\n          ]\n        },\n        \"roles\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            }\n          ]\n        }\n      },\n      \"type\": \"users\"\n    }\n  ]\n}"
    },
    {
      "name": "Bad Request",
      "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  \"data\": {\n    \"type\": \"downtime\",\n    \"attributes\": {\n      \"scope\": \"<string>\",\n      \"monitor_identifier\": {\n        \"monitor_id\": \"<long>\"\n      },\n      \"display_timezone\": \"UTC\",\n      \"message\": \"<string>\",\n      \"mute_first_recovery_notification\": \"<boolean>\",\n      \"notify_end_states\": [\n        \"warn\",\n        \"warn\"\n      ],\n      \"notify_end_types\": [\n        \"expired\",\n        \"expired\"\n      ],\n      \"schedule\": {\n        \"recurrences\": [\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          },\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          }\n        ],\n        \"timezone\": \"UTC\"\n      }\n    }\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/downtime",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "downtime"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\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  \"data\": {\n    \"type\": \"downtime\",\n    \"attributes\": {\n      \"scope\": \"<string>\",\n      \"monitor_identifier\": {\n        \"monitor_id\": \"<long>\"\n      },\n      \"display_timezone\": \"UTC\",\n      \"message\": \"<string>\",\n      \"mute_first_recovery_notification\": \"<boolean>\",\n      \"notify_end_states\": [\n        \"warn\",\n        \"warn\"\n      ],\n      \"notify_end_types\": [\n        \"expired\",\n        \"expired\"\n      ],\n      \"schedule\": {\n        \"recurrences\": [\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          },\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          }\n        ],\n        \"timezone\": \"UTC\"\n      }\n    }\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/downtime",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "downtime"
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\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  \"data\": {\n    \"type\": \"downtime\",\n    \"attributes\": {\n      \"scope\": \"<string>\",\n      \"monitor_identifier\": {\n        \"monitor_id\": \"<long>\"\n      },\n      \"display_timezone\": \"UTC\",\n      \"message\": \"<string>\",\n      \"mute_first_recovery_notification\": \"<boolean>\",\n      \"notify_end_states\": [\n        \"warn\",\n        \"warn\"\n      ],\n      \"notify_end_types\": [\n        \"expired\",\n        \"expired\"\n      ],\n      \"schedule\": {\n        \"recurrences\": [\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          },\n          {\n            \"duration\": \"<string>\",\n            \"rrule\": \"<string>\",\n            \"start\": \"<string>\"\n          }\n        ],\n        \"timezone\": \"UTC\"\n      }\n    }\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/downtime",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "downtime"
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\n  ]\n}"
    }
  ]
}