Chilkat Online Tools

Unicode C++ / Datadog API Collection / Submit a Service Check

Back to Collection Items

void ChilkatSample(void)
    {
    jarr.AddObjectAt(-1);    jsonObj_1->UpdateString(L"check",L"app.ok");    jsonObj_1->UpdateInt(L"status",0);    jsonObj_1->UpdateString(L"tags[0]",L"environment:test");    jsonObj_1->UpdateString(L"host_name",L"app.host1");    jsonObj_1->UpdateString(L"message",L"app is running");    jsonObj_1->UpdateInt(L"timestamp",12636800);    jarr.AddObjectAt(-1);    jsonObj_1 = jarr.ObjectAt(jarr.get_Size() - 1);    jsonObj_1->UpdateString(L"check",L"app.ok");    jsonObj_1->UpdateInt(L"status",0);    jsonObj_1->UpdateString(L"tags[0]",L"environment:test");    jsonObj_1->UpdateString(L"host_name",L"app.host1");    jsonObj_1->UpdateString(L"message",L"app is running");    jsonObj_1->UpdateInt(L"timestamp",-99255440);    jarr.EmitSb(sbRequestBody);    resp->GetBodySb(sbResponseBody);    jResp.LoadSb(sbResponseBody);    jResp.put_EmitCompact(false);
    }

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Accept: text/json"
	-d '[
  {
    "check": "app.ok",
    "status": 0,
    "tags": [
      "environment:test"
    ],
    "host_name": "app.host1",
    "message": "app is running",
    "timestamp": 12636800
  },
  {
    "check": "app.ok",
    "status": 0,
    "tags": [
      "environment:test"
    ],
    "host_name": "app.host1",
    "message": "app is running",
    "timestamp": -99255440
  }
]'
https://api.app.ddog-gov.com/api/v1/check_run

Postman Collection Item JSON

{
  "name": "Submit a Service Check",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "text/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "[\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": 12636800\n  },\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": -99255440\n  }\n]",
      "options": {
        "raw": {
          "headerFamily": "json",
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/api/v1/check_run",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "check_run"
      ]
    },
    "description": "Submit a list of Service Checks.\n\n**Notes**:\n- A valid API key is required.\n- Service checks can be submitted up to 10 minutes in the past."
  },
  "response": [
    {
      "name": "Payload accepted",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "text/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "[\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": 12636800\n  },\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": -99255440\n  }\n]",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/check_run",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "check_run"
          ]
        }
      },
      "status": "Accepted",
      "code": 202,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"status\": \"ok\"\n}"
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "text/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "[\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": 12636800\n  },\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": -99255440\n  }\n]",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/check_run",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "check_run"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"Bad Request\",\n    \"Bad Request\"\n  ]\n}"
    },
    {
      "name": "Authentication Error",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "text/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "[\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": 12636800\n  },\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": -99255440\n  }\n]",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/check_run",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "check_run"
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"Bad Request\",\n    \"Bad Request\"\n  ]\n}"
    },
    {
      "name": "Request timeout",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "text/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "[\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": 12636800\n  },\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": -99255440\n  }\n]",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/check_run",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "check_run"
          ]
        }
      },
      "status": "Request Timeout",
      "code": 408,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"Bad Request\",\n    \"Bad Request\"\n  ]\n}"
    },
    {
      "name": "Payload too large",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "text/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "[\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": 12636800\n  },\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": -99255440\n  }\n]",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/check_run",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "check_run"
          ]
        }
      },
      "status": "Request Entity Too Large",
      "code": 413,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/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  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": 12636800\n  },\n  {\n    \"check\": \"app.ok\",\n    \"status\": 0,\n    \"tags\": [\n      \"environment:test\"\n    ],\n    \"host_name\": \"app.host1\",\n    \"message\": \"app is running\",\n    \"timestamp\": -99255440\n  }\n]",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v1/check_run",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "check_run"
          ]
        }
      },
      "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}"
    }
  ]
}