## Parametertabell felles for alle metodene (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
```

| PARAMETERNAVN     | VERDI | OBLIGATORISK | STANDARDVERDI |
|:------------------|:------|:------------:|:-------------:|
| application_id    | [Application ID](https://www.bulkgate.com/no/dokumentasjon/api-administrasjon/administrasjon-av-api/) | **Ja** | - | 
| application_token | [Application token](https://www.bulkgate.com/no/dokumentasjon/api-administrasjon/api-token/) | **Ja** | - |
| phone_number      | Telefonnummeret til kontakten | **Ja** | - |

## Vise samtykke

### API-URL (show)
URL som brukes til å sende HTTP-forespørsler:
```url
https://portal.bulkgate.com/api/1.0/address-book/agreement/show
```

### Eksempel på fullstendig forespørsel (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"
}
```

### Svaret på denne kommandoen kan være: (show)

**Ved suksess:**
```json
{
    "data": {
        "phone_number": "+420777777777",
        "agreement": "2023-03-30T13:29:15+02:00"
    }
}
```

**Ved feil:**
```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
}
```

## Legge til samtykke
> [!NOTE]
> Hvis telefonnummeret ikke finnes i adresseboken, legges det til automatisk. 

### API-URL (add)
URL som brukes til å sende HTTP-forespørsler:
```url
https://portal.bulkgate.com/api/1.0/address-book/agreement/add
```

### Eksempel på fullstendig forespørsel (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"
}
```

### Svaret på denne kommandoen kan være: (add)

**Ved suksess:**
```json
{
    "data": {
        "phone_number": "+420777777777",
        "agreement": "2023-03-30T12:59:26+02:00"
    }
}
```

**Ved feil:**

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

## Fjerne samtykke

### API-URL (remove)
URL som brukes til å sende HTTP-forespørsler:
```url
https://portal.bulkgate.com/api/1.0/address-book/agreement/remove
```

### Eksempel på fullstendig forespørsel (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"
}
```

### Svaret på denne kommandoen kan være: (remove)

**Ved suksess:**
```json
{
    "data": {
        "phone_number": "+420777777777",
        "agreement": "null"
    }
}
```

**Ved feil:**
```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
}
```
