# Ottieni webhook (GET)

Recupera i dettagli di un webhook specifico tramite il suo identificatore univoco.

## Endpoint

```
GET https://api.pocketalert.app/v1/webhooks/{tid}
```

## Autenticazione

> **Info: Obbligatoria**
>
> Includi una di queste intestazioni nella tua richiesta:
> - `Token: <your-api-key>` — Ottienila da [Chiavi API](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — Da [Accedi](https://info.pocketalert.app/api/user/login.md)

## Richiesta

### Parametri di percorso

| Parametro | Tipo | Obbligatorio | Descrizione |
|-----------|------|:--------:|-------------|
| `tid` | string | ✅ | Identificatore univoco del webhook |

### Intestazioni

| Intestazione | Obbligatoria | Descrizione |
|--------|:--------:|-------------|
| `Token` | ✅ | La tua chiave API |
| `Authorization` | ✅ | `Bearer <jwt-token>` |

### Esempio di richiesta

**cURL**

```bash
curl -X GET "https://api.pocketalert.app/v1/webhooks/kblf7mh9j8jjyeh4fx" \
  -H "Token: your-api-key"
```

**JavaScript**

```javascript
const tid = 'kblf7mh9j8jjyeh4fx';
const response = await fetch(`https://api.pocketalert.app/v1/webhooks/${tid}`, {
  headers: { 'Token': 'your-api-key' }
});
const webhook = await response.json();
```

**Python**

```python
import requests

tid = 'kblf7mh9j8jjyeh4fx'
response = requests.get(
    f'https://api.pocketalert.app/v1/webhooks/{tid}',
    headers={'Token': 'your-api-key'}
)
print(response.json())
```

**PHP**

```php
$tid = 'kblf7mh9j8jjyeh4fx';
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/webhooks/'.$tid);

return $response->json();
```

## Risposta

### Risposta di successo

> **Tip: 200 OK**
>
> Restituisce l'oggetto webhook

| Campo | Tipo | Descrizione |
|-------|------|-------------|
| `tid` | string | Identificatore univoco del webhook |
| `name` | string | Nome del webhook |
| `url` | string | Slug dell'URL del webhook |
| `message` | string | Modello del messaggio |
| `is_active` | boolean | Indica se il webhook è attivo |
| `created_at` | string | Data e ora di creazione |

```json
{
  "tid": "kblf7mh9j8jjyeh4fx",
  "name": "GitHub Push",
  "url": "cs994rqfkk8ljngt",
  "message": "Push to %repository.name%: %head_commit.message%",
  "is_active": true,
  "created_at": "01.09.2023 22:38:48"
}
```

### Risposte di errore

| Stato | Descrizione |
|:------:|-------------|
| `401` | Non autorizzato — Token non valido o mancante |
| `404` | Non trovato — Il webhook non esiste |
