> 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-hoxhunt-api.md).

# Pull data from the Hoxhunt API

## Overview

Get a list of call records using the [Hoxhunt API](https://support.hoxhunt.com/hc/en-us/sections/11930695623836-Hoxhunt-API).

## 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

N/A

### Secrets

You must define these credentials in Onum:

* `hoxhuntToken` will reference your Hoxhunt token.

To do it, enter a **Name** for the secret and then click the **Value** field. Click **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 corresponding field.

{% 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: false
withEnumerationPhase: false
collectionPhase:
  paginationType: "cursor"
  cursorSelector: ".data.incidents.pageInfo.endCursor"
  initialRequest:
    method: POST
    url: "https://app.hoxhunt.com/graphql-external"
    headers:
      - name: Authorization
        value: "Authtoken ${secrets.hoxhuntToken}"
    bodyType: raw
    bodyRaw: |
      {
        "query": "query($startDate: DateTime, $endDate: DateTime) {\n  incidents(\n    first: 100, \n    filter: {\n      createdAt: {\n        gte: $startDate,\n        lte: $endDate\n      }\n    }\n  ) {\n    edges {\n      node {\n        id\n        createdAt\n        updatedAt\n        status\n        severity\n        reportedBy\n        description\n      }\n    }\n    pageInfo {\n      hasNextPage\n      endCursor\n    }\n  }\n}",
        "variables": "{\n  \"startDate\": \"${temporalWindow.from}\",\n  \"endDate\": \"${temporalWindow.to}\"\n}"
      }
  nextRequest:
    method: POST
    url: "https://app.hoxhunt.com/graphql-external"
    headers:
      - name: Authorization
        value: "Authtoken ${secrets.hoxhuntToken}"
    bodyType: raw
    bodyRaw: |
      {
        "query": "query($cursor: String, $startDate: DateTime, $endDate: DateTime) {\n  incidents(\n    first: 100, \n    after: $cursor,\n    filter: {\n      createdAt: {\n        gte: $startDate,\n        lte: $endDate\n      }\n    }\n  ) {\n    edges {\n      node {\n        id\n        createdAt\n        updatedAt\n        status\n        severity\n        reportedBy\n        description\n      }\n    }\n    pageInfo {\n      hasNextPage\n      endCursor\n    }\n  }\n}",
        "variables": "{\n  \"cursor\": \"${pagination.cursor}\"\n  \"startDate\": \"${temporalWindow.from}\",\n  \"endDate\": \"${temporalWindow.to}\"\n}"
      }
  output:
    select: ".data.incidents"
    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** - `5m`
* **Offset** - `5m`
* **Format** - `RFC3339`

**Collection Phase**

* **Pagination Type**<mark style="color:red;">**\***</mark> - `Cursor`
* **Cursor Selector**<mark style="color:$primary;">**\***</mark> - `.data.incidents.pageInfo.endCursor`

**Initial Request**

* **Response Type**<mark style="color:$primary;">**\***</mark> - `JSON`
* **Method**<mark style="color:$primary;">**\***</mark> - `POST`
* **URL**<mark style="color:$primary;">**\***</mark> - `https://app.hoxhunt.com/graphql-external`
* **Headers**
  * **Name** - `Authorization`
  * **Value** - `Authtoken ${secrets.hoxhuntToken}`
* **Body Type**<mark style="color:$primary;">**\***</mark> - `Raw`
* **Body Content**<mark style="color:$primary;">**\***</mark> -&#x20;

```
{
  "query": "query($startDate: DateTime, $endDate: DateTime) {\n  incidents(\n    first: 100, \n    filter: {\n      createdAt: {\n        gte: $startDate,\n        lte: $endDate\n      }\n    }\n  ) {\n    edges {\n      node {\n        id\n        createdAt\n        updatedAt\n        status\n        severity\n        reportedBy\n        description\n      }\n    }\n    pageInfo {\n      hasNextPage\n      endCursor\n    }\n  }\n}",
  "variables": "{\n  \"startDate\": \"${temporalWindow.from}\",\n  \"endDate\": \"${temporalWindow.to}\"\n}"
}
```

**Next Request**

* **Response Type**<mark style="color:$primary;">**\***</mark> - `JSON`
* **Method**<mark style="color:$primary;">**\***</mark> - `POST`
* **URL**<mark style="color:$primary;">**\***</mark> - `https://app.hoxhunt.com/graphql-external`
* **Headers**
  * **Name** - `Authorization`
  * **Value** - `Authtoken ${secrets.hoxhuntToken}`
* **Body Type**<mark style="color:$primary;">**\***</mark> - `Raw`
* **Body Content**<mark style="color:$primary;">**\***</mark> -&#x20;

```
{
  "query": "query($cursor: String, $startDate: DateTime, $endDate: DateTime) {\n  incidents(\n    first: 100, \n    after: $cursor,\n    filter: {\n      createdAt: {\n        gte: $startDate,\n        lte: $endDate\n      }\n    }\n  ) {\n    edges {\n      node {\n        id\n        createdAt\n        updatedAt\n        status\n        severity\n        reportedBy\n        description\n      }\n    }\n    pageInfo {\n      hasNextPage\n      endCursor\n    }\n  }\n}",
  "variables": "{\n  \"cursor\": \"${pagination.cursor}\"\n  \"startDate\": \"${temporalWindow.from}\",\n  \"endDate\": \"${temporalWindow.to}\"\n}"
}
```

**Output**

* **Select**<mark style="color:$primary;">**\***</mark> - `.data.incidents`
* **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://docs.onum.com/the-workspace/listeners/labels) if needed.
