Get Subscriptions Feed

Questa modalità è riservata agli enti centrali o di livello nazionale. Scopri come richiedere l'autorizzazione ->

Descrizione

L'API Get Subscriptions Feed permette di effettuare il download degli hash dei Codici Fiscali dei cittadini iscritti/disiscritti a un servizio per una specifica data (UTC-YYYY-MM-DD).

Lo scopo del subscription feed è mettere a disposizione degli enti centrali uno strumento per minimizzare le chiamate verso l'infrastruttura di IO attraverso un filtro costruito dall'ente stesso.

Le informazioni del subscription feed sono aggiornate al giorno precedente. Per la costruzione del subscription feed, dovrai interrogare il servizio per ogni giorno a partire dalla data del 24/03/2020 fino alla data attuale e salvare i dati nella tua infrastruttura.

In nessun caso sarà possibile richiedere i codici fiscali in chiaro.

Per i dettagli tecnici su come codificare i Codici Fiscali del tuo sistema per poterli confrontare con quelli tornati dal subscription feed, espandi la sezione che segue.

Get Subscriptions Feed

Returns the hashed fiscal codes of users that subscribed to or unsubscribed from your service on the provided date (UTC).

By querying this feed everyday, you will be able to retrieve the "delta" of users that subscribed and unsubscribed from your service. You will have to keep a list of users somewhere in your infrastructure that you will keep updated at all times by adding the subscribed users and removing the unsubscribed users.

You will then be able to query this local list to know which users you can send messages, to without having to query getProfile for each message.

To avoid sharing the citizens fiscal codes, the API will provide the hex encoding of the SHA256 hash of the upper case fiscal code. In pseudo code CF_HASH = LOWERCASE(HEX(SHA256(UPPERCASE(CF)))).

Access to this feed is subject to case-by-case authorization, and it is primarily intended for large-scale services, such as those pertaining to organizations that have an extensive user base (including geographically), and/or need to send very high volumes of messages per day.

This feed serves the purpose of minimizing data processing activities while preserving optimization of API calls and data accuracy. Organizations allowed are required to query this feed everyday.

GEThttps://api.io.pagopa.it/api/v1/subscriptions-feed/{date}
Authorization
Path parameters
date*string

A date in the format YYYY-MM-DD.

Example: "2019-09-15"
Response

Found.

Body
dateUTC*DateUTC (string)

A date in the format YYYY-MM-DD.

subscriptions*SubscriptionsList (array of FiscalCodeHash (string))
unsubscriptions*SubscriptionsList (array of FiscalCodeHash (string))
Request
const response = await fetch('https://api.io.pagopa.it/api/v1/subscriptions-feed/{date}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "dateUTC": "text",
  "subscriptions": [
    "text"
  ],
  "unsubscriptions": [
    "text"
  ]
}

Per una risposta corretta si ottiene:

  1. lo status code della risposta è 200

  2. nel body di risposta il campo subscriptions e unsubscriptions

Esempi

### REQUEST
curl --location --request GET 'https://api.io.pagopa.it/api/v1/subscriptions-feed/2020-02-23' \
--header 'Ocp-Apim-Subscription-Key: __YOUR_API_KEY__'
### RESPONSE
{
"dateUTC": "2020-02-23",
"subscriptions": [ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ],
"unsubscriptions": [ ]
}

Risorse utili

https://developer.io.italia.it/openapi.html#operation/getSubscriptionsFeedForDate