## Tableau des paramètres commun à toutes les méthodes (show, add, remove)

```url
https://portal.bulkgate.com/api/1.0/address-book/agreement/show
https://portal.bulkgate.com/api/1.0/address-book/agreement/add
https://portal.bulkgate.com/api/1.0/address-book/agreement/remove
```

| NOM DU PARAMÈTRE  | VALEUR                                        | OBLIGATOIRE | VALEUR PAR DÉFAUT |
|:------------------|:----------------------------------------------|:---------:|:-------------:|
| application_id    | [Application ID](https://www.bulkgate.com/fr/documentation/administration-api-et-tokens/administration-api/) |  **Oui**  |       -       | 
| application_token | [Token de l'application](https://www.bulkgate.com/fr/documentation/administration-api-et-tokens/tokens-d-api/)	     |  **Oui**  |       -       |
| phone_number      | Numéro de téléphone du contact                |  **Oui**  |       -       |

## Afficher le consentement

### URL de l'API (show)
URL utilisée pour envoyer les requêtes HTTP :
```url
https://portal.bulkgate.com/api/1.0/address-book/agreement/show
```

### Exemple de requête complète (show)

```http-json
POST /api/1.0/address-book/agreement/show HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json

{
	"application_id": 451,
	"application_token": "NKN02TWE6NfBkfl-your-secret-token-Wf05GaqLIWLW4aBj",
	"phone_number": "+420777777777"
}
```

### La réponse à cette commande peut être : (show)

**En cas de succès :**
```json
{
    "data": {
        "phone_number": "+420777777777",
        "agreement": "2023-03-30T13:29:15+02:00"
    }
}
```

**En cas d'erreur :**
```json
{
    "type": "number_not_found",
    "code": 400,
    "error": "Number not found",
    "detail": null
}
```

```json
{
    "type": "invalid_phone_mobile",
    "code": 400,
    "error": "Invalid phone mobile",
    "detail": null
}
```

## Ajouter le consentement
> [!NOTE]
> Si le numéro de téléphone n'existe pas dans le carnet d'adresses, il y sera ajouté automatiquement. 

### URL de l'API (add)
URL utilisée pour envoyer les requêtes HTTP :
```url
https://portal.bulkgate.com/api/1.0/address-book/agreement/add
```

### Exemple de requête complète (add)

```http-json
POST /api/1.0/address-book/agreement/add HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json

{
	"application_id": 451,
	"application_token": "NKN02TWE6NfBkfl-your-secret-token-Wf05GaqLIWLW4aBj",
	"phone_number": "+420777777777"
}
```

### La réponse à cette commande peut être : (add)

**En cas de succès :**
```json
{
    "data": {
        "phone_number": "+420777777777",
        "agreement": "2023-03-30T12:59:26+02:00"
    }
}
```

**En cas d'erreur :**

```json
{
    "type": "invalid_phone_mobile",
    "code": 400,
    "error": "Invalid phone mobile",
    "detail": null
}
```

## Retirer le consentement

### URL de l'API (remove)
URL utilisée pour envoyer les requêtes HTTP :
```url
https://portal.bulkgate.com/api/1.0/address-book/agreement/remove
```

### Exemple de requête complète (remove)

```http-json
POST /api/1.0/address-book/agreement/remove HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json

{
	"application_id": 451,
	"application_token": "NKN02TWE6NfBkfl-your-secret-token-Wf05GaqLIWLW4aBj",
	"phone_number": "+420777777777"
}
```

### La réponse à cette commande peut être : (remove)

**En cas de succès :**
```json
{
    "data": {
        "phone_number": "+420777777777",
        "agreement": "null"
    }
}
```

**En cas d'erreur :**
```json
{
    "type": "number_not_found",
    "code": 400,
    "error": "Number not found",
    "detail": null
}
```

```json
{
    "type": "invalid_phone_mobile",
    "code": 400,
    "error": "Invalid phone mobile",
    "detail": null
}
```
