# Liste des désabonnements

{% hint style="info" %}
A noter : les comptes-rendus sont reçus en moyenne quelques secondes après l’envoi du mail ; cependant, ce délai peut s’étendre jusqu’à 48h maximum selon les opérateurs et la charge de notre plateforme.
{% endhint %}

## URL

<mark style="color:red;">`GET`</mark> `https://api.mailpartner.fr/v1/bulk-status`

#### **Paramètres obligatoires**

<table data-full-width="false"><thead><tr><th width="180">Nom</th><th>Valeur</th></tr></thead><tbody><tr><td><code>apiKey</code></td><td><a href="https://my.mailpartner.fr/dashboard/api">Votre clé API</a></td></tr></tbody></table>

#### Paramètres optionnels

<table><thead><tr><th width="262">Nom</th><th>Valeur</th></tr></thead><tbody><tr><td><code>_format</code></td><td><code>json</code> ou <code>xml</code></td></tr></tbody></table>

#### Requête

{% tabs %}
{% tab title="PHP" %}

```php
?php
 
        // Prepare data for GET request
        $data = 'apiKey=YOUR_API_KEY';
 
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL,'http://api.mailpartner.fr/v1/unsubscribe/list?'.$data);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
 
 
        $result = curl_exec($curl);
        curl_close($curl);
 
        // Process your response here
        echo $result;
?>
```

{% endtab %}

{% tab title="VB.net" %}

```vbnet
Imports System.IO
Imports System.Net
 
Module Module1
 
  Sub Main()
 
    Dim base_url As String = "http://api.mailpartner.fr/v1/"
    Dim apiKey As String = "VOTRE_APIKEY"
    Dim mail As String = "xxx@www.com"
    Dim messageId As Integer = XXX
 
    #check credits
    Dim url As String
    url = base_url & "unsubscribe/list" & "?apiKey=" & apiKey
 
    Dim credits As String
    credits = apiRequest("GET", url, Nothing)
 
  End Sub
 
  Function apiRequest(method As String, url As String, parameters As String) As String
 
    Dim request As HttpWebRequest
    request = WebRequest.Create(url)
    request.Method = method
    request.Timeout = 10000   # timeout in ms
    request.ContentType = "application/json; charset=utf-8"
    request.ContentLength = 0
 
    #set POST data
    If Not String.IsNullOrEmpty(parameters) Then
      request.ContentLength = parameters.Length
      Using reqStream As StreamWriter = New StreamWriter(request.GetRequestStream())
        reqStream.Write(parameters)
      End Using
    End If
 
    #get response
    Dim returnValue As String = Nothing
    Using response As HttpWebResponse = request.GetResponse()
      If response.StatusCode = HttpStatusCode.OK Then
        Using resStream = response.GetResponseStream()
          If resStream IsNot Nothing Then
            Using reader As New StreamReader(resStream)
              returnValue = reader.ReadToEnd()
            End Using
          End If
        End Using
      End If
    End Using
    apiRequest = returnValue
 
  End Function
 
End Module
```

{% endtab %}

{% tab title="Python" %}

```python
# std
import logging
import json
from collections import OrderedDict
 
# 3p
import requests
 
API_KEY = "MY API KEY"
URL = "http://api.mailpartner.fr/v1"
 
class MailPartner():
    def get_list_stop(self):
		url = URL + "/unsubscribe/list?apiKey=" + API_KEY
		r = requests.get(url)
		r_json = r.json()
		if r_json.get("success") == True:
			print(r_json)
			status = True
		else:
			print(r_json)
			status = False
		return status
```

{% endtab %}

{% tab title="cURL" %}

```
curl -H “Content-Type: application/json” -X GET http://api.mailpartner.fr/v1/unsubscribe/list?apiKey=xxx
```

{% endtab %}
{% endtabs %}

#### **Réponse**

{% tabs %}
{% tab title="json" %}

```json
{
  "success": true,
  "code": 200,
  "nbData": 1,
  "data": [
    {
      "id": 19,
      "email": "xxx@www.com",
      "createdAt": "2015-07-20 10:19:45"
    }
  ]
}
```

{% endtab %}

{% tab title="xml" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<result>
    <entry>true</entry>
    <entry>200</entry>
    <entry>3</entry>
    <entry>
        <entry>
            <entry>19</entry>
            <entry>
                <![CDATA[+33xxxxxxxxx]]>
            </entry>
            <entry>
                <![CDATA[2015-07-20 10:19:45]]>
            </entry>
        </entry>
    </entry>
</result>
```

{% endtab %}
{% endtabs %}

#### **Erreurs**

{% tabs %}
{% tab title="json" %}

```json
{
    "success": false,
    "code": 10,
    "message": "Clé API incorrecte"
}
```

{% endtab %}

{% tab title="xml" %}

```xml
<?xml version='1.0' encoding='UTF-8'?>
<result>
    <entry>false</entry>
    <entry>10</entry>
    <entry>Clé API incorrecte</entry>
</result>
```

{% endtab %}
{% endtabs %}

#### **Code erreurs**

| Code de réponse | Réponse                 |
| --------------- | ----------------------- |
| 1               | La Clé API est requise  |
| 10              | Clé API incorrecte      |
| 200             | Tout s’est bien passé ! |
