Chilkat Online Tools

unicodeC / Squadcast API V3 / Bulk Acknowledge Incidents

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    HCkHttpResponseW resp;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http = CkHttpW_Create();

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

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

    // {
    //   "incident_ids": [
    //     "5f04e3a08fada03f23aac811",
    //     "5f04e3a08fada03f23aac812",
    //     "5f04e3a08fada03f23aac813"
    //   ]
    // }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"incident_ids[0]",L"5f04e3a08fada03f23aac811");
    CkJsonObjectW_UpdateString(json,L"incident_ids[1]",L"5f04e3a08fada03f23aac812");
    CkJsonObjectW_UpdateString(json,L"incident_ids[2]",L"5f04e3a08fada03f23aac813");

    // Adds the "Authorization: Bearer <access_token>" header.
    CkHttpW_putAuthToken(http,L"<access_token>");

    resp = CkHttpW_PostJson3(http,L"https://api.squadcast.com/v3/incidents/acknowledge",L"application/json",json);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        return;
    }

    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpResponseW_Dispose(resp);


    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);

    }

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-d '{
    "incident_ids": [
        "5f04e3a08fada03f23aac811",
        "5f04e3a08fada03f23aac812",
        "5f04e3a08fada03f23aac813"
    ]
}'
https://api.squadcast.com/v3/incidents/acknowledge

Postman Collection Item JSON

{
  "name": "Bulk Acknowledge Incidents",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{sq_pb_auth_header}}",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"incident_ids\": [\n        \"5f04e3a08fada03f23aac811\",\n        \"5f04e3a08fada03f23aac812\",\n        \"5f04e3a08fada03f23aac813\"\n    ]\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/incidents/acknowledge",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "incidents",
        "acknowledge"
      ]
    },
    "description": "- This endpoint is used to bulk acknowledge the incident by IDs.\n- Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header."
  },
  "response": [
    {
      "name": "200 OK",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"incident_ids\": [\n        \"5f04e3a08fada03f23aac811\",\n        \"5f04e3a08fada03f23aac812\",\n        \"5f04e3a08fada03f23aac813\"\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/acknowledge",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            "acknowledge"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"data\": \"all incident successfully acknowledged\"\n}"
    },
    {
      "name": "400 Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"incident_ids\": [\n        \"5f04e3a08fada03f23aac811\",\n        \"5f04e3a08fada03f23aac812\",\n        \"5f04e3a08fada03f23aac813\"\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/acknowledge",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            "acknowledge"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 400,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "401 Unauthorized",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"incident_ids\": [\n        \"5f04e3a08fada03f23aac811\",\n        \"5f04e3a08fada03f23aac812\",\n        \"5f04e3a08fada03f23aac813\"\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/acknowledge",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            "acknowledge"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 401,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "403 Forbidden",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"incident_ids\": [\n        \"5f04e3a08fada03f23aac811\",\n        \"5f04e3a08fada03f23aac812\",\n        \"5f04e3a08fada03f23aac813\"\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/acknowledge",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            "acknowledge"
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 403,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "500 Internal Server Error",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"incident_ids\": [\n        \"5f04e3a08fada03f23aac811\",\n        \"5f04e3a08fada03f23aac812\",\n        \"5f04e3a08fada03f23aac813\"\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/acknowledge",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            "acknowledge"
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 500,\n        \"error_message\": \"<string>\"\n    }\n}"
    }
  ]
}