Chilkat Online Tools

Android / Squadcast API V3 / Get Incident Events

Back to Collection Items

// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    CkHttp http = new CkHttp();
    boolean success;

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateInt("offset",1);
    queryParams.UpdateInt("limit",10);
    queryParams.UpdateString("sort","asc");
    queryParams.UpdateString("deduped","true");

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

    CkHttpResponse resp = http.QuickRequestParams("GET","https://api.squadcast.com/v3/incidents/:incidentID/events",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());
        return;
        }

    Log.i(TAG, String.valueOf(resp.get_StatusCode()));
    Log.i(TAG, resp.bodyStr());


  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}

Curl Command

curl -G -d "offset=1"
	-d "limit=10"
	-d "sort=asc"
	-d "deduped=true"
	-H "Authorization: Bearer <access_token>"
https://api.squadcast.com/v3/incidents/:incidentID/events

Postman Collection Item JSON

{
  "name": "Get Incident Events",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{sq_pb_auth_header}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/incidents/:incidentID/events?offset=1&limit=10&sort=asc&deduped=true",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "incidents",
        ":incidentID",
        "events"
      ],
      "query": [
        {
          "key": "offset",
          "value": "1",
          "description": "non zero value"
        },
        {
          "key": "limit",
          "value": "10",
          "description": "non zero value, maximum is 10"
        },
        {
          "key": "sort",
          "value": "asc",
          "description": "sort it by either asc or desc"
        },
        {
          "key": "deduped",
          "value": "true",
          "description": "if set to true, it will return only the deduped events.\n\nif set to false, it will return only the non-deduped event.\n\notherwise it will return all the events"
        }
      ],
      "variable": [
        {
          "key": "incidentID",
          "value": "5d81d9bc60e42f6b99ca4307"
        }
      ]
    },
    "description": "- This endpoint is used to get all the deduped incident events details by either ID or number.\n- Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header.\n\nQuery Params:\n```\noffset - non zero value\nlimit - non zero value, maximum is 10\nsort - sort it by either asc or desc\ndeduped - if set to true, it will return only the deduplicated events. if set to false, it will return only the non-deduplicated event, otherwise it will return all the events\n```"
  },
  "response": [
    {
      "name": "200 OK",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/events?offset=1&limit=10&sort=asc&deduped=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "events"
          ],
          "query": [
            {
              "key": "offset",
              "value": "1"
            },
            {
              "key": "limit",
              "value": "10"
            },
            {
              "key": "sort",
              "value": "asc"
            },
            {
              "key": "deduped",
              "value": "true"
            }
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5f6480a22379e9c06df6a32e"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n  \"data\": {\n    \"events\": [\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:02.721Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:02.401Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:02.088Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:01.769Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:01.454Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:01.091Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:00.689Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:41:00.24Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      },\n      {\n        \"incident_id\": \"5f6480a22379e9c06df6a32e\",\n        \"alert_source_id\": \"5e868c596b90eec3d4148737\",\n        \"message\": \"Memory out of set threshold : 70.1%\",\n        \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n        \"time_of_creation\": \"2020-09-18T09:40:59.689Z\",\n        \"tags\": null,\n        \"deduplication_reason\": {\n          \"matched_event_id\": \"5f6480a2b1bafb2fcccce904\",\n          \"evaluated_expression\": \"true\",\n          \"time_window\": 3600\n        },\n        \"payload\": {\n          \"description\": \"Memory usage of platform pod is above set threshold of 70%\\n\\nThreshold: 70%\\nCurrent usage: 70.1%\",\n          \"event_id\": \"6\",\n          \"message\": \"Memory out of set threshold : 70.1%\",\n          \"metric\": {\n            \"absolute\": {\n              \"current_value\": 1.402,\n              \"threshold\": 1.4,\n              \"unit\": \"GB\"\n            },\n            \"pod\": \"platform-d23ixi-ug5ty\",\n            \"relative\": {\n              \"current_value\": 70.1,\n              \"threshold\": 70\n            },\n            \"time\": \"2020-09-18T09:37:13.607Z\"\n          },\n          \"status\": \"trigger\"\n        }\n      }\n    ]\n  },\n  \"meta\": {\n    \"total\": 20,\n    \"count\": 10,\n    \"current\": \"https://api.squadcast.com/v3/incidents/5f6480a22379e9c06df6a32e/events?offset=0&limit=10&deduped=true\",\n    \"next\": \"https://api.squadcast.com/v3/incidents/5f6480a22379e9c06df6a32e/events?deduped=true&limit=10&offset=10\"\n  }\n}"
    },
    {
      "name": "401 Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/events?offset=1&limit=1",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "events"
          ],
          "query": [
            {
              "key": "offset",
              "value": "1"
            },
            {
              "key": "limit",
              "value": "1"
            }
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4305"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 401,\n        \"error_message\": \"<string>\"\n    }\n}"
    }
  ]
}