> For the complete documentation index, see [llms.txt](https://docs.onum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.onum.com/listeners/listener-integrations/pull-data-from-http-endpoints/pull-data-from-the-mimecast-api/threats.md).

# Threats

## Overview

Get a list of threat events through the [Mimecast API](https://developer.services.mimecast.com/docs/threatssecurityeventsanddataforcg/1/routes/threats/v1/events/get) using the **HTTP Pull** Listener.

## HTTP Pull Listener configuration

In Falcon Onum, go to the **Listeners** area and click **New Listener > HTTP Pull**. Give a name to your new Listener and enter the following data:

### Parameters

Add the following parameter:

* **Name** - `domain`
* **Value** - Enter your Mimecast domain name.

### Secrets

You must define these credentials in Onum:

* `client_id` will reference your Mimecast client ID.
* `client_secret` will reference your Mimecast client secret.

To do it, click **Add element** and enter a **Name** for the secret (in this case, `client_id`). Then, click the **Value** field and select **New secret** to create a new one:

* Give the secret a **Name**.
* Turn off the **Expiration date** option.
* Click **Add new value** and paste the secret corresponding to the value.
* Click **Save**.

You can now select the secret you just created in the **Value** field list. Repeat the process for the `client_secret`.

{% hint style="info" %}
Learn more about secrets in Onum in [this article](/settings/organization-settings/secrets-management.md).
{% endhint %}

### Setup

After entering the required parameters and secrets, you can choose to manually enter the rest of configuration fields, or simply paste the given YAML:

{% tabs %}
{% tab title="Config as YAML" %}
Toggle **ON** the **Config as YAML** option to enable a free text field where you can paste the following YAML:

```yaml
withTemporalWindow: true
temporalWindow:
  duration: 5m
  offset: 5m
  tz: UTC
  format: RFC3339
withAuthentication: true
authentication:
  type: token
  token:
    request:
      method: POST
      url: https://${parameters.domain}/oauth/token
      headers:
        - name: Content-Type
          value: application/x-www-form-urlencoded
        - name: Accept
          value: application/json
      bodyType: urlEncoded
      bodyParams:
        - name: client_id
          value: '${secrets.client_id}'
        - name: client_secret
          value: '${secrets.client_secret}'
        - name: grant_type
          value: 'client_credentials'
    tokenPath: ".access_token"
    authInjection:
      in: header
      name: Authorization
      prefix: 'Bearer '
      suffix: ''
withEnumerationPhase: false
collectionPhase:
  paginationType: cursor
  cursorSelector: ".meta.nextPage"
  initialRequest:
    method: GET
    url: "https://${parameters.domain}/threats/v1/events"
    headers:
      - name: Accept
        value: application/json
      - name: Content-Type
        value: application/json
    queryParams:
      - name: timestampRangeStartsAt
        value: ${temporalWindow.from}
      - name: timestampRangeEndsAt
        value: ${temporalWindow.to}
      - name: pageSize
        value: 50
  nextRequest:
    method: GET
    url: "https://${parameters.domain}/threats/v1/events"
    headers:
      - name: Accept
        value: application/json
      - name: Content-Type
        value: application/json
    queryParams:
      - name: timestampRangeStartsAt
        value: ${temporalWindow.from}
      - name: timestampRangeEndsAt
        value: ${temporalWindow.to}
      - name: pageSize
        value: 50
      - name: pageToken
        value: ${pagination.cursor}
  output:
    select: ".value"
    map: "."
    outputMode: element
```

{% endtab %}

{% tab title="Manually configure" %}
**Temporal Window**

Toggle **ON** to add a temporal window for events. This repeatedly shifts the time window over which data is collected.

* **Duration**<mark style="color:$primary;">**\***</mark> - `5m`
* **Offset**<mark style="color:$primary;">**\***</mark> - `5m`
* **Format**<mark style="color:$primary;">**\***</mark> - `RFC3339`

**Authentication**

Toggle **ON** and configure these parameters:

* **Type**<mark style="color:red;">**\***</mark> - `Token`
* **Token Retrieve Based Authentication**
  * **Request**&#x20;
    * **Method**<mark style="color:red;">**\***</mark> - `POST`
    * **URL**<mark style="color:red;">**\***</mark> - `https://${parameters.domain}/oauth/token`
  * **Headers**&#x20;
    * **Name** - `Content-type`
    * **Value** - `application/x-www-form-urlencoded`
    * **Name** - `Accept`
    * **Value** - `application/json`
  * **Body Type**<mark style="color:red;">**\***</mark> - `UrlEncoded`
  * **Body Params**
    * **Name** - `client_id`
    * **Value** - `${secrets.client_id}`
    * **Name** - `client_secret`
    * **Value** - `${secrets.client_secret}`
    * **Name** - `grant type`
    * **Value** - `client_credentials`
* **Token Path**<mark style="color:red;">**\***</mark> - `.access_token`
* **Auth Injection**
  * **In**<mark style="color:red;">**\***</mark> - `header`
  * **Name**<mark style="color:red;">**\***</mark> - `authorization`
  * **Prefix** - `'Bearer '`
  * **Suffix** - `''`

**Collection Phase**&#x20;

* **Pagination Type**<mark style="color:red;">**\***</mark> - `Cursor`
* **Cursor Selector**<mark style="color:red;">**\***</mark> - `.meta.pagination.next`
* **Initial Request**&#x20;
  * **Response Type**<mark style="color:$primary;">**\***</mark> - `JSON`
  * **Method**<mark style="color:red;">**\***</mark> - `GET`
  * **URL**<mark style="color:red;">**\***</mark> - `https://${parameters.domain}/threats/v1/events`
* **Headers**
  * **Name** - `Accept`
  * **Value** - `application/json`
  * **Name** - `Content-Type`
  * **Value** - `application/json`
* **Query Params**<mark style="color:$primary;">**\***</mark>
  * **Name** - `timestampRangeStartsAt`
  * **Value** - `${temporalWindow.from}`
  * **Name** - `timestampRangeEndsAt`
  * **Value** - `${temporalWindow.to}`
  * **Name** - `pageSize`
  * **Value** - `50`
* **Next Request**&#x20;
  * **Response Type**<mark style="color:$primary;">**\***</mark> - `JSON`
  * **Method**<mark style="color:red;">**\***</mark> - `GET`
  * **URL**<mark style="color:red;">**\***</mark> - `https://${parameters.domain}/threats/v1/events`
  * **Headers**
    * **Name** - `Accept`
    * **Value -** `application/json`
    * **Name** - `Content-Type`
    * **Value -** `application/json`
* **Query Params**<mark style="color:$primary;">**\***</mark>
  * **Name** - `timestampRangeStartsAt`
  * **Value** - `${temporalWindow.from}`
  * **Name** - `timestampRangeEndsAt`
  * **Value** - `${temporalWindow.to}`
  * **Name** - `pageSize`
  * **Value** - `50`
  * **Name** - `pageToken`
  * **Value** - `${pagination.cursor}`
* **Output**&#x20;
  * **Select**<mark style="color:$primary;">**\***</mark> - `.value`
  * **Map** - `.`
  * **Output Mode**<mark style="color:$primary;">**\***</mark> - `element`
    {% endtab %}
    {% endtabs %}

When you're done, click **Create labels** to move on to the next step and define the required [Labels](https://app.gitbook.com/o/9sm794iTBacZSmhxRER6/s/kxZeV4nlXcIAjMGZxzLI/the-workspace/listeners/labels) if needed.
