# Event Attempt

When an Event delivery fails, an event attempt will be registered. It carries information meant to help you debug event reception issues.

### The Event Attempt object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the event attempt. |
| `code` | STRING | Delivery error code. |
| `created` | STRING | Creation datetime. Example: "2022-01-01T00:00:00.000000+00:00". |
| `eventId` | STRING | ID of the associated Event. |
| `message` | STRING | Delivery error description. |
| `webhookId` | STRING | ID of the associated Webhook. |

### List failed Webhook Event delivery attempts

`GET /v2/event/attempt`

Get information on failed webhook event delivery attempts.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `eventIds` | OPTIONAL | List of Event ids to filter attempts. Example: ["5656565656565656", "4545454545454545"] |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `webhookIds` | OPTIONAL | List of Webhook ids to filter attempts. Example: ["5656565656565656", "4545454545454545"] |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkinfra

attempts = starkinfra.event.attempt.query(limit=10)

for attempt in attempts:
    print(attempt)
```

**Response**

```python
Attempt(
    id=6891221774008321,
    code=CONNECTION_ERROR,
    message=Connection refused,
    event_id=5719405850615809,
    webhook_id=5601079539523584,
    created=2022-06-01T00:00:00.000000+00:00
)
```

### Get an Event Attempt

`GET /v2/event/attempt/:id`

Get a single event attempt by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Unique id of the event attempt entity. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkinfra

attempt = starkinfra.event.attempt.get("6891221774008321")

print(attempt)
```

**Response**

```python
Attempt(
    id=6891221774008321,
    code=CONNECTION_ERROR,
    message=Connection refused,
    event_id=5719405850615809,
    webhook_id=5601079539523584,
    created=2022-06-01T00:00:00.000000+00:00
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkinfra.com/api/v2/event-attempt-python.md)
- [Node.js](https://docs.starkinfra.com/api/v2/event-attempt-node.md)
- [PHP](https://docs.starkinfra.com/api/v2/event-attempt-php.md)
- [Java](https://docs.starkinfra.com/api/v2/event-attempt-java.md)
- [Ruby](https://docs.starkinfra.com/api/v2/event-attempt-ruby.md)
- [Elixir](https://docs.starkinfra.com/api/v2/event-attempt-elixir.md)
- [.NET](https://docs.starkinfra.com/api/v2/event-attempt-dotnet.md)
- [Go](https://docs.starkinfra.com/api/v2/event-attempt-go.md)
- [Clojure](https://docs.starkinfra.com/api/v2/event-attempt-clojure.md)
- [cURL](https://docs.starkinfra.com/api/v2/event-attempt-curl.md)
