Documentazione

Indice dei contenuti

Consent Solution – Documentazione API HTTP

Le API HTTP della Consent Solution ti permettono di salvare e recuperare le azioni di consenso portate a termine dai tuoi utenti, d’ora in poi definiti “interessati”.

Novità: abbiamo aggiunto un canale Beta, così puoi testare le ultime funzionalità prima che vengano rese disponibili sul canale di default, il Current.

Header

Autenticazione

Al fine di poter scrivere tramite le nostre API, forniamo due tipologie di chiavi:

  • Chiave pubblica, in genere utilizzata dalla libreria JavaScript
  • Chiave privata, in genere utilizzata dall’API HTTP

Tutte le chiamate API, sia tramite HTTP che tramite JS, specificano se sono state autenticate tramite chiave pubblica o privata. Le chiamate effettuate mediante chiave privata sono più affidabili in quanto forniscono maggiore certezza quando è necessario verificare che i dati siano stati realmente inviati dall’utente.

Per le API HTTP, la chiave privata va inviata tramite l’header ApiKey. Le chiavi pubbliche sono accettate solo sull’endpoint POST /public/consent.

Content-Type

Per inviare dati alla nostra API HTTP, devi impostare l’header Content-Type come application/json o application/x-www-form-urlencoded.

API output

Attenzione

Tieni presente che sul canale Current le risposte sono text/html o application/json, sul canale Beta sono sempre application/json.

Per impostazione predefinita ogni risposta json viene sottoposta ad escape, di conseguenza (ad esempio) una “<” diventa un “\u003c”. Per fare l’unescape della risposta json, puoi passare il parametro “unescape_json” su qualsiasi richiesta .

Attenzione però, perché la risposta risultante potrebbe non essere sicura da incorporare in un documento. Assicurati quindi di fare un nuovo escape ogni volta che la usi nel front-end.

GET /consent?unescape_json=true

In PHP:

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/consent?unescape_json=true');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Con cURL:

curl "http://stg-consent.iubenda.com/consent?unescape_json=true" \
     -H 'ApiKey: your-secret-api-key'

Otterrebbe un risultato senza caratteri di escape (non sicuro, quindi assicurati di fare l’escape quando la usi nel front-end)

# GET /consent?unescape_json=true

{
  "id": "32d16262-2e9a-4bad-abcd-5cbb46471047",
  "timestamp": "2018-11-06T08:58:01+00:00",
  "owner": "0",
  "source": "private",
  "subject": {
    "id": "123123",
    "email": "Olga.Mayert@gmail.comTest1",
    "first_name": "Luz",
    "last_name": "Koss",
    "verified": true
  },
  "preferences": {
    "mailing_list": "true",
    "tos_accepted": "false"
  },
  "legal_notices": [],
  "proofs": [
    {
      "form": "<form>",
      "content": "<script>"
    }
  ]
}
# GET /consent

{
  "id": "32d16262-2e9a-4bad-abcd-5cbb46471047",
  "timestamp": "2018-11-06T08:58:01+00:00",
  "owner": "0",
  "source": "private",
  "subject": {
    "id": "123123",
    "email": "Olga.Mayert@gmail.comTest1",
    "first_name": "Luz",
    "last_name": "Koss",
    "verified": true
  },
  "preferences": {
    "mailing_list": "true",
    "tos_accepted": "false"
  },
  "legal_notices": [],
  "proofs": [
    {
      "form": "\u003cform\u003e",
      "content": "\u003cscript\u003e"
    }
  ]
}

Limiti al numero di chiamate

Il numero massimo di chiamate è di 5 per secondo e 10800 per ora. Lato server, se superi questo limite riceverai un messaggio “429 Too Many Requests”.

Dimensione massima delle chiamate

Abbiamo impostato un limite massimo di 350kb per chiamata. Lato server, se superi questo limite riceverai un messaggio “413 Request Entity Too Large”.

Consenso

CREATE consent

Esempi

POST https://consent.iubenda.com/consent

Beta:

POST https://consent.iubenda.com/beta/consent
{
  "subject": {
    "id": "J02eZvKYlo2ClwuJ1",
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": "John Doe",
    "verified": false
  },
  "legal_notices": [
    {
      "identifier": "privacy_policy",
      "version": "123"
    },
    {
      "identifier": "terms",
      "version": "123"
    }
  ],
  "proofs": [
    {
      "content": "proof_1",
      "form": "proof form"
    }
  ],
  "preferences": {
    "newsletter": false,
    "privacy_policy": true
  }
}

Questa chiamata creerà un nuovo evento di consenso.

La risposta è la seguente:

200 OK
{
  "id": "de801ca9-abec-45e2-8f7c-729822cfffad",
  "timestamp": "2018-05-04T14:52:26Z",
  "subject_id": "J02eZvKYlo2ClwuJ1"
}
timestamp Compilato automaticamente (se non fornito) Stringa Timestamp ISO 8601 del momento in cui è avvenuto il consenso
subject Oggetto
id Compilato automaticamente (se non fornito) Stringa
email Stringa
first_name Stringa
last_name Stringa
full_name Stringa
verified Boolean Campo che segnala se un interessato è verificato o meno, ad esempio attraverso double opt-in
legal_notices Array Array di oggetti contenenti dati sugli avvisi legali
identifier Stringa privacy_policy, cookie_policy, terms o un identificativo personalizzato
version Compilato automaticamente con il valore dell’ultima versione disponibile (se non fornito) Stringa
proofs Array Array di oggetti contenente dati sulle prove di consenso
content Testo
form Testo
preferences Oggetto Insieme di coppie chiave-valore relative alle preferenze dell’utente per ogni azione di consenso
ip_address Compilato automaticamente quando viene usato autodetect_ip_address Stringa Considerato solo quando si utilizza una chiave privata. Salva sul consenso l’indirizzo IP passato. Default null
autodetect_ip_address Default true Stringa Considerato solo quando si utilizza una chiave pubblica. Abilita o disabilita l’autodetect dell’IP (true, false). Default true

GET consent

Esempi

GET https://consent.iubenda.com/consent/:id
200 OK
{
  "id": "de801ca9-abec-45e2-8f7c-729822cfffad",
  "timestamp": "2018-05-04T14:52:26Z",
  "owner": "1234",
  "subject": {
    "id": "J02eZvKYlo2ClwuJ1",
    "email": "subject@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": "John Doe"
    "verified": false
  },
  "preferences": {
    "privacy_policy": true,
    "newsletter": false
  },
  "legal_notices": [
    {
      "identifier": "privacy_policy",
      "version": "123"
    },
    {
      "identifier": "terms",
      "version": "123"
    }
  ],
  "proofs": [
    {
      "content": "proof_1",
      "form": "proof form"
    }
  ]
}

In aggiunta alle proprietà appena elencate:

id Identificativo univoco dello specifico evento di consenso
owner Identificativo univoco del proprietario dell’API
source private public Chiarisce se il consenso è stato inviato con API pubblica o privata

Elenco dei consensi

Esempi

GET https://consent.iubenda.com/consent

Beta:

GET https://consent.iubenda.com/beta/consent

Tutti i campi sono opzionali, alcuni verrano compilati automaticamente se non viene fornito alcun valore. I campi evidenziati in giallo sono disponibili solo sul canale Beta, gli altri sia sul Current che sul Beta.

Parametri della query accettati:

from_time Opzionale Stringa Filtra i consensi per timestamp. Restituisce tutti i consensi da quel momento in poi (incluso). Formati accettati: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (timestamp unix in secondi). Default null
to_time Opzionale Stringa Filtra i consensi per timestamp. Restituisce tutti i consensi fino a quel momento (incluso). Formati accettati: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (timestamp unix in secondi). Default null
source Opzionale Stringa Filtra i consensi per chiave pubblica o privata. Valori possibili: public, private. Default null
ip_address Opzionale Stringa Filtra per indirizzo IP. Default null. Formati accettati: IP address | none
subject_id Opzionale Stringa Filtra per ID dell’interessato. Default null
subject_email_exact opzionale Stringa Filtra per email dell’interessato. Deve corrispondere esattamente (distingue tra maiuscole e minuscole). Default null
subject_email Opzionale Stringa Filtra per email dell’interessato. Cerca di far corrispondere parti dell’email fornita divisa per punti e spazi. Ad esempio “@test.com” restituirà gli interessati con un’email contenente “@test” o “com” (non distingue tra maiuscole e minuscole). Default null
subject_first_name Opzionale Stringa Filtra per nome dell’interessato. Deve corrispondere esattamente (distingue tra maiuscole e minuscole). Default null
subject_last_name Opzionale Stringa Filtra per cognome dell’interessato. Deve corrispondere esattamente (distingue tra maiuscole e minuscole). Default null
subject_full_name Opzionale Stringa Filtra per nome completo dell’interessato. Cerca di far corrispondere parti del nome completo fornito diviso per punti e spazi. Ad esempio “mario rossi” restituirà tutti gli interessati il cui nome completo contiene “mario” o “rossi” (non distingue tra maiuscole e minuscole). Default null
subject_verified Opzionale Stringa Filtra per stato verificato dell’interessato. Valori possibili: true, false. Default null
preference_key Opzionale Stringa Filtra per i consensi in cui esiste la chiave. Default null
starting_after Opzionale stringa (UUID) Cursore che indica dopo quale consenso devono essere restituiti i risultati (cursore escluso). Default null
limit Opzionale Intero Numero restituito di risultati. Min: 1, Max: 100. Default 10

Ricorda che i risultati sono ordinati di default per timestamp discendente.

Risposta:

200 OK
[
  {
    "id": "bd25e1fc-da53-4b48-8fef-0ecb6068f666",
    "timestamp": "2018-06-11T15:20:07+00:00",
    "owner": "181789",
    "source": "public",
    "subject": {
      "id": "35d1f4ba-5a52-43d8-9fee-68e356a2a9bd",
      "email": "35d1f4ba_43d8_9fee_5a52_68e356a2a9bd@example.net",
      "first_name": "Filomena",
      "last_name": "Turcotte",
      "full_name": "Filomena Turcotte"
    },
    "preferences": {
      "newsletter": true
    }
  },
  {
    "id": "9b6c3cea-3350-4528-89ad-9148db358e20",
    "timestamp": "2018-06-11T15:20:07+00:00",
    "owner": "678255",
    "source": "private",
    "subject": {
      "id": "d685ed47-bdd8-44c4-92c4-0bbf961f2577",
      "email": "0bbf961f2577_92c4_bdd8_d685ed47_44c4@example.net",
      "first_name": "Rachael",
      "last_name": "Hammes",
      "full_name": "Rachael Hammes"
    },
    "preferences": {
      "newsletter": false
    }
  },
  {
    "id": "9783a523-f35e-4133-9875-0b6aed3bce32",
    "timestamp": "2018-06-11T15:20:07+00:00",
    "owner": "837689",
    "source": "public",
    "subject": {
      "id": "b6a14232-ba1a-4a20-afed-fa93c68eb5aa",
      "email": "afed.b6a14232.fa93c68eb5aa.4a20.ba1a@example.com",
      "first_name": "Oliver",
      "last_name": "Gibson",
      "full_name": "Oliver Gibson"
    },
    "preferences": {}
  },
  {
    "id": "92297398-e1fe-4e95-8f15-35d6dcb42897",
    "timestamp": "2018-06-11T15:20:07+00:00",
    "owner": "802558",
    "source": "private",
    "subject": {
      "id": "da024bf5-e571-499b-b20d-65a41789b5a6",
      "email": "e571_499b_65a41789b5a6_da024bf5_b20d@example.net",
      "first_name": "Ike",
      "last_name": "Miller",
      "full_name": "Ike Miller"
    },
    "preferences": {
      "third_party": true,
      "newsletter": true
    }
  },
  {
    "id": "7bbde760-b859-48bf-8cd3-9b1f035c8ef5",
    "timestamp": "2018-06-11T15:20:07+00:00",
    "owner": "615811",
    "source": "private",
    "subject": {
      "id": "a429fa55-c271-43f2-9ba1-8ce3b48c1093",
      "email": "43f2.a429fa55.8ce3b48c1093.9ba1.c271@example.com",
      "first_name": "Macy",
      "last_name": "Farrell",
      "full_name": "Macy Farrell"
    },
    "preferences": {
      "third_party": true,
      "newsletter": true
    }
  },
  {
    "id": "175aa1a4-b9ee-4278-8074-aa1b1384292a",
    "timestamp": "2018-06-11T15:20:07+00:00",
    "owner": "915663",
    "source": "private",
    "subject": {
      "id": "69753d3f-4048-401e-a3b2-112047b91e67",
      "email": "a3b2.4048.69753d3f.112047b91e67.401e@example.net",
      "first_name": "Kaleigh",
      "last_name": "Schulist",
      "full_name": "Kaleigh Schulist"
    },
    "preferences": {}
  },
  {
    "id": "fe7daa65-3d58-4c75-902f-ca0664442f73",
    "timestamp": "2018-06-11T15:20:06+00:00",
    "owner": "743776",
    "source": "public",
    "subject": {
      "id": "234fde6a-34b0-4371-b0a1-bac3436e6c12",
      "email": "bac3436e6c12.b0a1.4371.234fde6a.34b0@example.org",
      "first_name": "Carson",
      "last_name": "Heidenreich",
      "full_name": "Carson Heidenreich"
    },
    "preferences": {
      "newsletter": false
    }
  }
]

Tieni presente che questo metodo non include le prove e gli avvisi legali del consenso. Devi chiamare GET /consent/:id per ottenere l’evento Consent completo.

Interessati

GET subject

Esempi

GET https://consent.iubenda.com/subjects/:id
200 OK
{
  "id": "J02eZvKYlo2ClwuJ1",
  "email": "john@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "verified": false,
  "timestamp": "2018-05-04T14:52:26Z"
  "preferences": {
    "privacy_policy": {
      "value": true,
      "consent_id": "de801ca9-abec-45e2-8f7c-729822cfffad"
    },
    "newsletter": {
      "value": true,
      "consent_id": "de801ca9-abec-45e2-8f7c-729822cfffad"
    }
  }
}

Elenco degli interessati (solo per il canale Beta)

Esempi

GET https://consent.iubenda.com/beta/subjects

Tutti i campi sono opzionali, alcuni verrano compilati automaticamente se non viene fornito alcun valore. I campi evidenziati in giallo sono disponibili solo sul canale Beta.

Parametri della query accettati:

id Opzionale Stringa Filtra per id. Deve corrispondere perfettamente. Default null
email_exact Opzionale Stringa Filtra per indirizzo email. Deve corrispondere perfettamente (distingue tra maiuscole e minuscole)
email Opzionale Stringa Filtra per indirizzo email. Cerca di far corrispondere parti dell’email fornita divisa per punti e spazi. Ad esempio “@test.com” restituirà gli interessati con un’email contenente “@test” o “com” (non distingue tra maiuscole e minuscole)
first_name Opzionale Stringa Filtra per nome. Deve corrispondere perfettamente (distingue tra maiuscole e minuscole)
last_name Opzionale Stringa Filtra per cognome. Deve corrispondere perfettamente (distingue tra maiuscole e minuscole)
full_name Opzionale Stringa Filtra per nome completo. Cerca di far corrispondere parti del nome completo fornito diviso per punti e spazi. Ad esempio “mario rossi” restituirà tutti gli interessati il cui nome completo contiene “mario” o “rossi” (non distingue tra maiuscole e minuscole)
from_time Opzionale Stringa Filtra gli interessati per timestamp. Restituisce tutti gli interessati che hanno prestato il consenso da quel momento in poi (incluso). Formati accettati: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (timestamp unix in secondi)
to_time Opzionale Stringa Filtra gli interessati per timestamp. Restituisce tutti gli interessati che hanno prestato il consenso fino a quel momento (incluso). Formati accettati: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (timestamp unix in secondi)
verified Opzionale Boolean Filtra per stato verificato dell’interessato. Valori possibili: true, false
fulltext Opzionale Stringa Filtra i risultati col valore di id, first_name, last_name, full_name, email
starting_after Opzionale Stringa Cursore che indica dopo quale interessato devono essere restituiti i risultati (cursore escluso)
limit Opzionale Numero Numero dei risultati restituiti. Min: 1, Max: 100.

Risposta:

[
  {
    "id": "d2a55da5-0777-4625-94bd-b69948703e71",
    "owner_id": "131132",
    "email": "rath.jorge@example.com",
    "first_name": "Jorge",
    "last_name": "Rath",
    "full_name": "Jorge Rath",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
  },
  {
    "id": "b75c6d0c-550f-4f84-9e92-2f351d481220",
    "owner_id": "131132",
    "email": "aufderhar_alfonso@example.net",
    "first_name": "Alfonso",
    "last_name": "Aufderhar",
    "full_name": "Alfonso Aufderhar",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
  },
  {
    "id": "a9c8c720-cb07-4a52-81c3-7cb7fb4f877e",
    "owner_id": "131132",
    "email": "vandervort.furman@example.net",
    "first_name": "Furman",
    "last_name": "Vandervort",
    "full_name": "Furman Vandervort",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
  },
  {
    "id": "6ccc2802-3bcb-49af-a4c5-14dc89ba94bc",
    "owner_id": "131132",
    "email": "alvis.rohan@example.org",
    "first_name": "Alvis",
    "last_name": "Rohan",
    "full_name": "Alvis Rohan",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
  },
  {
    "id": "5900f856-619e-42b0-92a5-b2ebd016ac01",
    "owner_id": "131132",
    "email": "brown.marlee@example.net",
    "first_name": "Marlee",
    "last_name": "Brown",
    "full_name": "Marlee Brown",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
  }
]

CREATE subject

Esempi

POST https://consent.iubenda.com/subjects
{
  "id": "J02eZvKYlo2ClwuJ1",
  "email": "john@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "full_name": "John Doe",
  "verified": false
}

Questo metodo crea un nuovo interessato e può essere usato anche da consent. Controlla la documentazione riferita al metodo consent per ulteriori dettagli.

id Compilato automaticamente (se non fornito) Stringa
email Opzionale Stringa
first_name opzionale Stringa
last_name opzionale Stringa
full_name opzionale Stringa
verified Opzionale Boolean Campo che segnala se un interessato è verificato o meno, ad esempio attraverso double opt-in
In arrivo:
custom_attributes Opzionale Oggetto Insieme di coppie chiave-valore contenenti attributi custom

La risposta è la seguente:

200 OK
{
  "id": "J02eZvKYlo2ClwuJ1",
  "timestamp": "2018-05-04T14:52:26Z"
}

UPDATE subject

Esempi

PATCH https://consent.iubenda.com/subjects/:id
{
  "first_name": "Mary",
  "verified": true
}

Questa chiamata aggiorna un interessato esistente.

La risposta è la seguente:

200 OK
{
  "id": "testsubject",
  "created_at": "2018-05-04T14:52:26Z"
}

Documenti legali

Versione del documento

Esempi

GET /legal_notices/:identifier/:version

Risposta:

# GET /legal_notices/privacy_policy/1
# 200 OK
{
    "identifier": "privacy_policy",
    "content": "legal text",
    "timestamp": "2018-05-16T13:55:57Z",
    "version": 1
}

Versioni di tutti i documenti

Esempi

GET /legal_notices/:identifier

Parametri della query accettati:

Nome Valore Descrizione
limit opzionale numero Limita il numero dei risultati. Default 10
starting_after opzionale numero Paginazione con cursore. Default null

Questo metodo supporta la paginazione con cursore tramite il parametro starting_after. Quest’ultimo prende la versione di un documento legale esistente e restituisce gli oggetti in ordine inverso.

# 200 OK
[
    {
        "identifier": "privacy_policy",
        "timestamp": "2018-05-16T13:55:57Z",
        "version": 3
    },
    {
        "identifier": "privacy_policy",
        "timestamp": "2018-03-16T13:55:57Z",
        "version": 2
    },
    {
        "identifier": "privacy_policy",
        "timestamp": "2018-01-16T13:55:57Z",
        "version": 1
    }
]

Nota: questo metodo si limita ai metadati e non include il contenuto del documento legale. Devi chiamare GET /legal_notices/:identifier/:version per ottenere il documento completo.

Se usi iubenda per i tuoi documenti legali, aggiorneremo automaticamente i contenuti del metodo legal_notices ogni volta che i tuoi documenti legali vengono cambiati. Puoi scoprire maggiori dettagli su questa funzionalità qui.

Elenco dei documenti legali (solo per il canale Beta)

Esempi

GET https://consent.iubenda.com/beta/legal_notices

Parametri della query accettati:

id Opzionale Stringa Filtra per id. Deve corrispondere perfettamente. Default null
identifier Opzionale Stringa Filtra per identificativo. Deve corrispondere perfettamente (distingue tra maiuscole e minuscole). Default null
version Opzionale Numero Filtra per versione. Deve corrispondere perfettamente. Default null
language Opzionale Stringa Filtra per documenti in una determinata lingua (utilizzando come formato ‘en’, ‘it’ etc.). Default null
from_time Opzionale Stringa Filtra i documenti per timestamp. Restituisce tutti i documenti da quel momento in poi (incluso). Formati accettati: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (timestamp unix in secondi). Default null
to_time Opzionale Stringa Filtra i documenti per timestamp. Restituisce tutti i documenti fino a quel momento (incluso). Formati accettati: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (timestamp unix in secondi). Default null
starting_after_version Opzionale Numero Cursore che indica dopo quale versione del documento devono essere restituiti i risultati (cursore escluso). Default null
starting_after_identifier Opzionale Stringa Cursore che indica dopo quale identifier del documento devono essere restituiti i risultati (cursore escluso). Default null
limit Opzionale Numero Numero di risultati restituiti. Min: 1, Max: 100. Default 10

Risposta:

[
  {
    "id": "0_cookie_policy",
    "owner_id": "0",
    "identifier": "cookie_policy",
    "version": 20,
    "timestamp": "2018-10-09T12:38:04Z",
    "content": {
      "en": "Et vinculum clam decerno arguo admoveo velum sponte tot suppellex venustas defendo dolor decumbo est.",
      "it": "Collum tutis esse confugo porro urbs varius abscido turpis decor praesentium tardus voluptate fugit numquam."
    }
  },
  {
    "id": "0_terms",
    "owner_id": "0",
    "identifier": "terms",
    "version": 19,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Venia valde vel surculus capitulus adfectus patior comparo acsi cur vero super cursim.",
      "it": "Consuasor arcesso conscendo crudelis cauda aer aut adeptio illo argentum comis subiungo subito colo."
    }
  },
  {
    "id": "0_cookie_policy",
    "owner_id": "0",
    "identifier": "cookie_policy",
    "version": 18,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Ullus voco aufero speculum fugiat audacia laboriosam vilicus amita trans aut ut.",
      "it": "Alo veritatis ipsa tristis cuius occaecati adflicto creta verecundia facere solvo despirmatio cupiditate crinis aqua bos."
    }
  },
  {
    "id": "0_privacy_policy",
    "owner_id": "0",
    "identifier": "privacy_policy",
    "version": 17,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Confero succedo caelum adhaero quo vir deorsum quaerat utor sit ustulo cribro.",
      "it": "Bibo cubitum unus est ambitus contego apparatus alo via abutor utroque xiphias voco."
    }
  },
  {
    "id": "0_privacy_policy",
    "owner_id": "0",
    "identifier": "privacy_policy",
    "version": 16,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Qui porro culpo attero benevolentia aut sed sulum adfero artificiose adsidue tam amo validus vel spectaculum.",
      "it": "Cerno ipsum fugit compello cursim ter surgo asporto debilito excepturi adversus facere."
    }
  },
  {
    "id": "0_terms",
    "owner_id": "0",
    "identifier": "terms",
    "version": 15,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Tunc timidus veritatis maiores advenio aperio testimonium defluo celo cuius adsuesco deripio.",
      "it": "Depulso dignissimos vinitor curatio caelestis cedo et sum concedo id admoneo appositus."
    }
  },
  {
    "id": "0_terms",
    "owner_id": "0",
    "identifier": "terms",
    "version": 14,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Repellat mollitia desidero videlicet est textilis stips nisi aequus solum depromo agnitio usus.",
      "it": "Vomito tonsor comitatus illum aut usitas laboriosam canonicus tepesco benigne confugo trado."
    }
  },
  {
    "id": "0_cookie_policy",
    "owner_id": "0",
    "identifier": "cookie_policy",
    "version": 13,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Temperantia alias somniculosus absorbeo utique caecus terror demitto trucido desidero baiulus sublime.",
      "it": "Perspiciatis at tredecim curriculum comprehendo deduco corrupti attonbitus barba cruentus communis comparo thorax cauda spero vito anser."
    }
  },
  {
    "id": "0_cookie_policy",
    "owner_id": "0",
    "identifier": "cookie_policy",
    "version": 12,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Allatus cena surculus ventito ver adversus torrens demo venustas toties veritas qui cado vis.",
      "it": "Talio avoco aptus compono et subiungo peior bellum depromo aureus torqueo adeptio nobis."
    }
  },
  {
    "id": "0_terms",
    "owner_id": "0",
    "identifier": "terms",
    "version": 11,
    "timestamp": "2018-10-09T12:38:03Z",
    "content": {
      "en": "Aliquam cubicularis tergum utor cinis concido ratione vociferor uter deduco tertius verecundia alo claustrum sto vos aegrotatio.",
      "it": "Corona ut comes sub coaegresco caute casus laboriosam tremo vulariter aegrotatio pauci callide assentator basium."
    }
  }
]

Crea un documento legale

Esempi

POST /legal_notices
{
    "identifier": "privacy_policy",
    "content": "privacy policy content",
    "timestamp": "2018-05-16T13:55:57Z"
}

Con contenuti in più lingue:

POST /legal_notices
{
    "identifier": "privacy_policy",
    "content": {
        "en": "privacy policy content",
        "it": "contenuto della privacy policy"
    },
    "timestamp": "2018-05-16T13:55:57Z"
}

Risposta:

# 200 OK
{
    "identifier": "privacy_policy",
    "timestamp": "2018-05-16T13:55:57Z",
    "version": 1
}

Crea più documenti legali

POST /legal_notices
[
    {
        "identifier": "privacy_policy",
        "content": "privacy policy content",
        "timestamp": "2018-05-16T13:55:57Z"
    },
        {
        "identifier": "cookie_policy",
        "content": "cookie policy content",
        "timestamp": "2018-05-16T13:55:57Z"
    }
]

Risposta:

# 200 OK
[
    {
        "identifier": "privacy_policy",
        "timestamp": "2018-05-16T13:55:57Z",
        "version": 1
    },
    {
        "identifier": "cookie_policy",
        "timestamp": "2018-05-16T13:55:57Z",
        "version": 1
    }
]

Esempi

POST /consent

$ curl https://consent.iubenda.com/consent \
    -X POST \
    -H "ApiKey: your-private-api-key" \
    -H "Content-Type: application/json" \
    -d  '{ "subject": { "id": "J02eZvKYlo2ClwuJ1", "email": "subject@example.com" }, "preferences": { "newsletter": true }, "legal_notices": [{ "identifier": "privacy_policy" }], "proofs": [{ "content": "proof_content", "form": "proof_form" }] }'

Risposta:


{
    "id": "1dbbc6f8-6a57-4407-b687-d6e6f818742f",
    "timestamp": "2018-06-06T09:48:44.265Z",
    "subject_id": "J02eZvKYlo2ClwuJ1"
}
GET /consent

$ curl https://consent.iubenda.com/consent/ \
    -H "ApiKey: your-private-api-key"

Risposta:


[{
    "id": "b04c4b2b-80b7-439f-8997-ade3d35cbb95",
    "timestamp": "2018-06-04T08:11:34.000+00:00",
    "owner": "521686",
    "source": "private",
    "subject": {
        "id": "0e371678-634a-4016-83ce-9b7c36f828e6",
        "email": "83ce_634a_4016_9b7c36f828e6_0e371678@example.com",
        "first_name": "Kianna",
        "last_name": "Fahey",
        "full_name": "Kianna Fahey",
        "verified": false
    },
    "preferences": {
        "newsletter": false
    }
}, {
    "id": "ee6644ea-08e9-4aaa-a7a9-18602731a123",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "681109",
    "source": "public",
    "subject": {
        "id": "8c6d1b71-0908-4604-948f-2f706500b5b1",
        "email": "0908.8c6d1b71.2f706500b5b1.4604.948f@example.org",
        "first_name": "Eleanora",
        "last_name": "Adams",
        "full_name": "Eleanora Adams",
        "verified": false
    },
    "preferences": {
        "newsletter": true
    }
}, {
    "id": "e7a9f5db-481e-4c80-ac7d-a35e35d37f98",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "178473",
    "source": "private",
    "subject": {
        "id": "d084ab70-0460-4523-94b2-44841055b49c",
        "email": "94b2_4523_44841055b49c_0460_d084ab70@example.com",
        "first_name": "Abbie",
        "last_name": "Heidenreich",
        "full_name": "Abbie Heidenreich",
        "verified": false
    },
    "preferences": {
        "third_party": true
    }
}, {
    "id": "e3481085-296c-4b11-a999-73d5d1309128",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "393753",
    "source": "private",
    "subject": {
        "id": "be8ca546-150d-4a6e-b2ac-ef76fb8a279e",
        "email": "b2ac_ef76fb8a279e_150d_4a6e_be8ca546@example.net",
        "first_name": "Grace",
        "last_name": "Dooley",
        "full_name": "Grace Dooley",
        "verified": false
    },
    "preferences": {
        "another_preference_key": false,
        "newsletter": false
    }
}, {
    "id": "e1be0320-a854-4b01-a468-49b1752ee4f3",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "629879",
    "source": "public",
    "subject": {
        "id": "f8878254-c7ae-4169-b474-19e90d7b2f4f",
        "email": "f8878254_b474_19e90d7b2f4f_4169_c7ae@example.net",
        "first_name": "Providenci",
        "last_name": "Kulas",
        "full_name": "Providenci Kulas",
        "verified": false
    },
    "preferences": {
        "newsletter": false,
        "random_preference_key": true,
        "third_party": true,
        "another_preference_key": false
    }
}, {
    "id": "cbe2bba8-d31d-4a27-9e2d-b38de4f22a68",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "989797",
    "source": "public",
    "subject": {
        "id": "6387dc5d-d474-4da8-8c40-8b197dee8d7c",
        "email": "6387dc5d.4da8.d474.8c40.8b197dee8d7c@example.com",
        "first_name": "Alan",
        "last_name": "Rutherford",
        "full_name": "Alan Rutherford",
        "verified": false
    },
    "preferences": {
        "newsletter": true,
        "random_preference_key": true
    }
}, {
    "id": "ca429c28-e1cd-4b95-87ae-48adb8fe56bb",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "885846",
    "source": "public",
    "subject": {
        "id": "b2ad578d-0aa9-4bd5-becd-e2e7a2019e7a",
        "email": "b2ad578d.becd.e2e7a2019e7a.0aa9.4bd5@example.net",
        "first_name": "Ruby",
        "last_name": "Lemke",
        "full_name": "Ruby Lemke",
        "verified": false
    },
    "preferences": {
        "third_party": true,
        "random_preference_key": false
    }
}, {
    "id": "bf12770e-840a-40cd-ab79-5d88576b6b73",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "369168",
    "source": "public",
    "subject": {
        "id": "d4f24d92-56c2-4372-8696-fec829da5ccc",
        "email": "fec829da5ccc.8696.4372.56c2.d4f24d92@example.com",
        "first_name": "Hank",
        "last_name": "Klein",
        "full_name": "Hank Klein",
        "verified": false
    },
    "preferences": {
        "newsletter": false
    }
}, {
    "id": "b489e2d4-2fc6-44e1-ba54-e5f81000d30a",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "781022",
    "source": "public",
    "subject": {
        "id": "38bc623f-b386-4b66-8ee6-5e7d91c19800",
        "email": "38bc623f.8ee6.4b66.5e7d91c19800.b386@example.net",
        "first_name": "Kamren",
        "last_name": "Pacocha",
        "full_name": "Kamren Pacocha",
        "verified": false
    },
    "preferences": {
        "newsletter": true
    }
}, {
    "id": "b2ec7aa8-35e7-470c-8b51-bd39fa686a3a",
    "timestamp": "2018-06-04T08:11:33.000+00:00",
    "owner": "527898",
    "source": "public",
    "subject": {
        "id": "0cc94c66-d9eb-4ace-af3d-1d48fba265f9",
        "email": "1d48fba265f9_4ace_af3d_d9eb_0cc94c66@example.net",
        "first_name": "Maryjane",
        "last_name": "Wiegand",
        "full_name": "Maryjane Wiegand",
        "verified": false
    },
    "preferences": {
        "newsletter": true
    }
}]
GET /consent/:id

$ curl https://consent.iubenda.com/consent/1dbbc6f8-6a57-4407-b687-d6e6f818742f \
    -H "ApiKey: your-private-api-key"

Risposta:


{
    "id": "1dbbc6f8-6a57-4407-b687-d6e6f818742f",
    "timestamp": "2018-06-06T09:48:44.000+00:00",
    "owner": "123",
    "source": "public",
    "subject": {
        "id": "J02eZvKYlo2ClwuJ1",
        "email": "subject@example.com"
    },
    "preferences": {
        "newsletter": "true"
    },
    "legal_notices": [{
        "identifier": "privacy_policy",
        "version": "latest"
    }],
    "proofs": [{
        "form": "proof_form",
        "content": "proof_content"
    }]
}
POST /consent

$consent_data = array(
    "subject" => array(
        "id" => "J02eZvKYlo2ClwuJ1",
        "email" => "subject@example.com"
    ),
    "legal_notices" => array(
        array(
            "identifier" => "newsletter"
        ),
        array(
            "identifier" => "privacy_policy"
        )
    ),
    "proofs" => array(
        array(
            "content" => "proof_content",
            "form" => "proof_form"
        )
    ),
    "preferences" => array(
        "newsletter" => true,
        "privacy_policy" => true
    )
);

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/consent');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));
curl_setopt($req, CURLOPT_POST, true);
curl_setopt($req, CURLOPT_POSTFIELDS, json_encode($consent_data));

$response = curl_exec($req);

Risposta:


{
    "id": "7abe5f70-22e4-4181-878c-9f931034fab5",
    "timestamp": "2018-06-08T08:25:30.395Z",
    "subject_id": "J02eZvKYlo2ClwuJ1"
}
GET /consent

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/consent');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Risposta:


[{
    "id": "b04c4b2b-80b7-439f-8997-ade3d35cbb95",
    "timestamp": "2018-06-04T08:11:34.000+00:00",
    "owner": "521686",
    "source": "private",
    "subject": {
        "id": "0e371678-634a-4016-83ce-9b7c36f828e6",
        "email": "83ce_634a_4016_9b7c36f828e6_0e371678@example.com",
        "first_name": "Kianna",
        "last_name": "Fahey",
        "full_name": "Kianna Fahey",
        "verified": false
    },
    "preferences": {
        "newsletter": false
    }
}]
GET /consent/:id

$req = curl_init();
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/consent/7abe5f70-22e4-4181-878c-9f931034fab5');
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Risposta:


{
    "id": "7abe5f70-22e4-4181-878c-9f931034fab5",
    "timestamp": "2018-06-08T08:25:30.000+00:00",
    "owner": "123",
    "source": "private",
    "subject": {
        "id": "J02eZvKYlo2ClwuJ1",
        "email": "subject@example.com"
    },
    "preferences": {
        "newsletter": true,
        "privacy_policy": true
    },
    "legal_notices": [{
        "identifier": "newsletter",
        "version": "1.0"
    }, {
        "identifier": "privacy_policy",
        "version": "1.0"
    }],
    "proofs": [{
        "form": "proof_form",
        "content": "proof_content"
    }]
}

Interessati

POST /subject

$ curl https://consent.iubenda.com/subjects \
    -X POST \
    -H "ApiKey: your-private-api-key" \
    -H "Content-Type: application/json" \
    -d '{ "email": "john@example.com", "first_name": "John", "last_name": "Doe" }'

Risposta:


{
    "id": "9f5a50f6-052c-4595-8bc4-760dc05d86ba",
    "timestamp": "2018-06-06T11:05:41.600Z"
}
GET /subject/:id

$ curl https://consent.iubenda.com/subjects/9f5a50f6-052c-4595-8bc4-760dc05d86ba \
    -H "ApiKey: your-private-api-key"

Risposta:


{
    "id": "9f5a50f6-052c-4595-8bc4-760dc05d86ba",
    "owner_id": "123",
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": null,
    "preferences": null,
    "verified": false,
    "timestamp": "2018-06-06T11:05:41+00:00"
}
PATCH /subject/:id

$ curl https://consent.iubenda.com/subjects/9f5a50f6-052c-4595-8bc4-760dc05d86ba \
    -X PATCH \
    -H "ApiKey: your-private-api-key" \
    -H "Content-Type: application/json" \
    -d '{ "email": "mary@example.com", "first_name": "Mary", "last_name": "Doe" }'

Risposta:


{
    "id": "9f5a50f6-052c-4595-8bc4-760dc05d86ba",
    "timestamp": "2018-06-06T11:05:41.000+00:00"
}

Scopri i parametri accettati.

GET /beta/subjects

$ curl https://consent.iubenda.com/beta/subjects \
  -X GET \
  -H "ApiKey: your-private-api-key" \
  -H "Content-Type: application/json"

Risposta:


[{
    "id": "d2a55da5-0777-4625-94bd-b69948703e71",
    "owner_id": "131132",
    "email": "rath.jorge@example.com",
    "first_name": "Jorge",
    "last_name": "Rath",
    "full_name": "Jorge Rath",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "b75c6d0c-550f-4f84-9e92-2f351d481220",
    "owner_id": "131132",
    "email": "aufderhar_alfonso@example.net",
    "first_name": "Alfonso",
    "last_name": "Aufderhar",
    "full_name": "Alfonso Aufderhar",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "a9c8c720-cb07-4a52-81c3-7cb7fb4f877e",
    "owner_id": "131132",
    "email": "vandervort.furman@example.net",
    "first_name": "Furman",
    "last_name": "Vandervort",
    "full_name": "Furman Vandervort",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "6ccc2802-3bcb-49af-a4c5-14dc89ba94bc",
    "owner_id": "131132",
    "email": "alvis.rohan@example.org",
    "first_name": "Alvis",
    "last_name": "Rohan",
    "full_name": "Alvis Rohan",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "5900f856-619e-42b0-92a5-b2ebd016ac01",
    "owner_id": "131132",
    "email": "brown.marlee@example.net",
    "first_name": "Marlee",
    "last_name": "Brown",
    "full_name": "Marlee Brown",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}]
GET /beta/subjects/:id

$ curl https://consent.iubenda.com/beta/subjects/9f5a50f6-052c-4595-8bc4-760dc05d86ba \
  -H "ApiKey: your-private-api-key"

Risposta:


{
    "id": "9f5a50f6-052c-4595-8bc4-760dc05d86ba",
    "owner_id": "123",
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": null,
    "preferences": null,
    "verified": false,
    "timestamp": "2018-06-06T11:05:41+00:00"
}
PATCH /beta/subjects/:id

$ curl https://consent.iubenda.com/beta/subjects/9f5a50f6-052c-4595-8bc4-760dc05d86ba \
  -X PATCH \
  -H "ApiKey: your-private-api-key" \
  -H "Content-Type: application/json" \
  -d '{ "email": "mary@example.com", "first_name": "Mary", "last_name": "Doe" }'

Risposta:


{
    "id": "9f5a50f6-052c-4595-8bc4-760dc05d86ba",
    "timestamp": "2018-06-06T11:05:41.000+00:00"
}
POST /subject

$subject_data = array(
    "email" => "subject@example.com",
    "first_name" => "John",
    "last_name" => "Doe"
);

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/subjects');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));
curl_setopt($req, CURLOPT_POST, true);
curl_setopt($req, CURLOPT_POSTFIELDS, json_encode($subject_data));

$response = curl_exec($req);

Risposta:


{
    "id": "df39c1bf-5f27-4c3a-bf94-64360cc7e4f8",
    "timestamp": "2018-06-11T08:57:13.662Z"
}
GET /subject/:id

$req = curl_init();
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/subjects/df39c1bf-5f27-4c3a-bf94-64360cc7e4f8');
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Risposta:


{
    "id": "df39c1bf-5f27-4c3a-bf94-64360cc7e4f8",
    "owner_id": "123",
    "email": "subject@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": null,
    "preferences": null,
    "verified": false,
    "timestamp": "2018-06-11T08:57:13+00:00"
}
PATCH /subject/:id

$subject_data = array(
    "first_name" => "Mary"
);

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/subjects/df39c1bf-5f27-4c3a-bf94-64360cc7e4f8');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));
curl_setopt($req, CURLOPT_POSTFIELDS, json_encode($subject_data));

$response = curl_exec($req);

Risposta:


{
    "id": "df39c1bf-5f27-4c3a-bf94-64360cc7e4f8",
    "timestamp": "2018-06-11T08:57:13.000+00:00"
}

Scopri i parametri accettati.

GET /beta/subjects

$subject_data = array(
    "email" => "subject@example.com",
    "first_name" => "John",
    "last_name" => "Doe"
);

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/beta/subjects');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));
curl_setopt($req, CURLOPT_POST, true);
curl_setopt($req, CURLOPT_POSTFIELDS, json_encode($subject_data));

$response = curl_exec($req);

Risposta:


[{
    "id": "d2a55da5-0777-4625-94bd-b69948703e71",
    "owner_id": "131132",
    "email": "rath.jorge@example.com",
    "first_name": "Jorge",
    "last_name": "Rath",
    "full_name": "Jorge Rath",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "b75c6d0c-550f-4f84-9e92-2f351d481220",
    "owner_id": "131132",
    "email": "aufderhar_alfonso@example.net",
    "first_name": "Alfonso",
    "last_name": "Aufderhar",
    "full_name": "Alfonso Aufderhar",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "a9c8c720-cb07-4a52-81c3-7cb7fb4f877e",
    "owner_id": "131132",
    "email": "vandervort.furman@example.net",
    "first_name": "Furman",
    "last_name": "Vandervort",
    "full_name": "Furman Vandervort",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "6ccc2802-3bcb-49af-a4c5-14dc89ba94bc",
    "owner_id": "131132",
    "email": "alvis.rohan@example.org",
    "first_name": "Alvis",
    "last_name": "Rohan",
    "full_name": "Alvis Rohan",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}, {
    "id": "5900f856-619e-42b0-92a5-b2ebd016ac01",
    "owner_id": "131132",
    "email": "brown.marlee@example.net",
    "first_name": "Marlee",
    "last_name": "Brown",
    "full_name": "Marlee Brown",
    "preferences": null,
    "verified": true,
    "timestamp": "2018-09-12T16:22:21+00:00"
}]
GET /beta/subjects/:id
$req = curl_init();
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/beta/subjects/df39c1bf-5f27-4c3a-bf94-64360cc7e4f8');
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Risposta:


{
    "id": "df39c1bf-5f27-4c3a-bf94-64360cc7e4f8",
    "owner_id": "123",
    "email": "subject@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": null,
    "preferences": null,
    "verified": false,
    "timestamp": "2018-06-11T08:57:13+00:00"
}
PATCH /beta/subjects/:id

$subject_data = array(
    "first_name" => "Mary"
);

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/beta/subjects/df39c1bf-5f27-4c3a-bf94-64360cc7e4f8');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));
curl_setopt($req, CURLOPT_POSTFIELDS, json_encode($subject_data));

$response = curl_exec($req);

Risposta:


{
    "id": "df39c1bf-5f27-4c3a-bf94-64360cc7e4f8",
    "timestamp": "2018-06-11T08:57:13.000+00:00"
}
POST /legal_notices

$ curl https://consent.iubenda.com/legal_notices \
    -X POST \
    -H "ApiKey: your-private-api-key" \
    -H "Content-Type: application/json" \
    -d '{ "identifier": "privacy_policy", "content": "privacy policy legal text" }'

Risposta:


{
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-06T15:56:10.090Z"
}
GET /legal_notices/:identifier/:version

$ curl https://consent.iubenda.com/legal_notices/privacy_policy/1 \
    -H "ApiKey: your-private-api-key"

Risposta:


{
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-06T15:56:10.000+00:00",
    "content": "privacy policy legal text"
}
GET /legal_notices/:identifier

$ curl https://consent.iubenda.com/legal_notices/privacy_policy \
    -H "ApiKey: your-private-api-key"

Risposta:


[{
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-06T15:56:10.000+00:00"
}]

Con parametri di limite e paginazione:


$ curl https://consent.iubenda.com/legal_notices/privacy_policy?limit=20&starting_after=3 \
    -H "ApiKey: your-private-api-key" \
    -G

Risposta:


[{
    "identifier": "privacy_policy",
    "version": 2,
    "timestamp": "2018-06-06T15:56:10.000+00:00"
}, {
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-06T15:56:10.000+00:00"
}]
POST /legal_notices

$legal_notice_data = array(
    "identifier" => "privacy_policy",
    "content" => "privacy policy legal text"
);

$req = curl_init();
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/legal_notices');
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));
curl_setopt($req, CURLOPT_POST, true);
curl_setopt($req, CURLOPT_POSTFIELDS, json_encode($legal_notice_data));

$response = curl_exec($req);

Risposta:


{
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-11T10:26:00.413Z"
}
GET /legal_notices/:identifier/:version

$req = curl_init();
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/legal_notices/privacy_policy/1');
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Risposta:


{
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-11T10:26:00.000+00:00",
    "content": "privacy policy legal text"
}
GET /legal_notices/:identifier

$req = curl_init();
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/legal_notices/privacy_policy');
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Risposta:


[{
    "identifier": "privacy_policy",
    "version": 5,
    "timestamp": "2018-06-11T10:35:17.000+00:00"
}, {
    "identifier": "privacy_policy",
    "version": 4,
    "timestamp": "2018-06-11T10:35:16.000+00:00"
}, {
    "identifier": "privacy_policy",
    "version": 3,
    "timestamp": "2018-06-11T10:35:15.000+00:00"
}, {
    "identifier": "privacy_policy",
    "version": 2,
    "timestamp": "2018-06-11T10:35:13.000+00:00"
}, {
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-11T10:26:00.000+00:00"
}]

Con parametri di limite e paginazione:


$req = curl_init();
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_URL, 'https://consent.iubenda.com/legal_notices/privacy_policy?limit=3&starting_after=4');
curl_setopt($req, CURLOPT_HTTPHEADER, array(
    'ApiKey: your-secret-api-key',
    'Content-Type: application/json'
));

$response = curl_exec($req);

Risposta:


[{
    "identifier": "privacy_policy",
    "version": 3,
    "timestamp": "2018-06-11T10:35:15.000+00:00"
}, {
    "identifier": "privacy_policy",
    "version": 2,
    "timestamp": "2018-06-11T10:35:13.000+00:00"
}, {
    "identifier": "privacy_policy",
    "version": 1,
    "timestamp": "2018-06-11T10:26:00.000+00:00"
}]

Leggi anche