Get Subscriptions Feed

Descrizione

API che permette di ottenere i codici fiscali in modalità hashed che si sono sottoscritti o disiscritti per una specifica data (UTC - YYYY-MM-DD). In questo modo è possibile scaricare gli utenti iscritti ad un servizio (identificato dalla API KEY), facendo una request per ogni giorno a partire dal 24/03/2020 e salvando i dati nella propria infrastruttura.

Per una risposta corretta ottengo:

  1. lo status code della risposta è 200

  2. nel body di risposta il campo subscriptions e unsubscriptions

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 applicato dall’ente stesso.

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

Prima che un servizio venga messo visibile in app, l'API restituirà l’elenco completo degli hash dei codici fiscali dei cittadini iscritti/disiscritti ad IO in un determinato giorno.

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"
Pattern: [0-9]{4}-[0-9]{2}-[0-9]{2}
Response

Found.

Body
dateUTC*DateUTC (string)

A date in the format YYYY-MM-DD.

Pattern: [0-9]{4}-[0-9]{2}-[0-9]{2}
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"
  ]
}

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

Last updated