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 singola 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 riscontrare costi di rete eccessivi. Per recuperare più messaggi in una sola chiamata API, utilizza batchGet.

Recupero di messaggi HL7v2 in blocco

I seguenti esempi mostrano come ottenere i contenuti dei messaggi HL7v2 in blocco.

Per maggiori informazioni, consulta projects.locations.datasets.hl7V2Stores.messages.batchGet.

curl

Per ricevere 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 da 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 che utilizza 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 ha esito positivo, 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 ricevere 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 da 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 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 ha esito positivo, 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