Recupero di messaggi HL7v2 in blocco

Questa pagina spiega come leggere in blocco i messaggi da un archivio HL7v2 utilizzando il metodo projects.locations.datasets.hl7V2Stores.messages.batchGet. Puoi utilizzare batchGet per recuperare fino a 100 messaggi HL7v2 con una sola chiamata.

Puoi utilizzare il messaggio projects.locations.datasets.hl7V2Stores.messages.get per recuperare un singolo messaggio HL7v2 alla volta, ma se hai molti messaggi, potresti incorrere in costi di rete eccessivi. Per recuperare più messaggi in una sola chiamata API, utilizza batchGet.

Recupero di messaggi HL7v2 in blocco

Gli esempi riportati di seguito mostrano come recuperare i contenuti dei messaggi HL7v2 in blocco.

Per ulteriori informazioni, vedi projects.locations.datasets.hl7V2Stores.messages.batchGet.

curl

Per recuperare i messaggi HL7v2 in blocco, effettua una richiesta GET e specifica le seguenti informazioni:

  • Il nome del set di dati padre
  • Il nome dell'archivio HL7v2
  • Un token di accesso
  • Il parametro di query names con i nomi dei messaggi HL7v2 che vuoi recuperare. Per ogni valore names, inserisci il percorso completo del messaggio nel formato: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID

L'esempio seguente mostra una richiesta GET mediante curl.

curl -X GET \
      -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
      "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID
      /locations/LOCATION/datasets/DATASET_ID
      /hl7V2Stores/HL7V2_STORE_ID/messages:batchGet?names=MESSAGE_NAME_1&names=MESSAGE_NAME_2&names=
      MESSAGE_NAME_3&view=FULL"

Se la richiesta riesce, il server restituisce la risposta in formato JSON:

{
  "messages" : [
    {
      "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID"
    }
  ]
}

PowerShell

Per recuperare i messaggi HL7v2 in blocco, effettua una richiesta GET e specifica le seguenti informazioni:

  • Il nome del set di dati padre
  • Il nome dell'archivio HL7v2
  • Un token di accesso
  • Il parametro di query names con i nomi dei messaggi HL7v2 che vuoi recuperare. Per ogni valore names, inserisci il percorso completo del messaggio nel formato: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID

Il seguente esempio mostra una richiesta GET mediante Windows PowerShell.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-WebRequest `
  -Method Get `
  -Headers $headers `
  -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages:batchGet?names=MESSAGE_NAME_1&names=MESSAGE_NAME_2&names=MESSAGE_NAME_3&view=FULL" | Select-Object -Expand Content

Se la richiesta riesce, il server restituisce la risposta in formato JSON:

{
  "messages" : [
    {
      "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID"
    }
  ]
}

Vedi anche