共用方式為


使用 cURL 存取 Azure 健康資料服務

在本文中,您將瞭解如何使用 cURL 存取 Azure 健康資料服務。

必要條件

PowerShell

CLI

取得 Azure 存取權杖

存取 Azure 健康資料服務之前,您必須以適當的權限授與使用者或用戶端應用程式。 如需如何授與權限的詳細資訊,請參閱 Azure 健康資料服務授權

有數種不同的方式可取得 Azure 健康資料服務的 Azure 存取權杖。

注意

請確定您已登入 Azure,且位於您已部署 Azure 健康資料服務執行個體的 Azure 訂用帳戶和租用戶中。

### check Azure environment and PowerShell versions
Get-AzContext 
Set-AzContext -Subscription <subscriptionid>
$PSVersionTable.PSVersion
Get-InstalledModule -Name Az -AllVersions
curl --version

### get access token for the FHIR service
$fhirservice="https://<fhirservice>.fhir.azurehealthcareapis.com"
$token=(Get-AzAccessToken -ResourceUrl $fhirservice).Token

### Get access token for the DICOM service
$dicomtokenurl= "https://dicom.healthcareapis.azure.com/"
$token=$( Get-AzAccessToken -ResourceUrl $dicomtokenurl).Token

注意

在 FHIR 服務受眾參數未對應到 FHIR 服務端點 URL 的情節中。 資源參數值應該對應至 FHIR 服務驗證刀鋒視窗下的受眾值。

存取 FHIR 服務中的資料

$fhirservice="https://<fhirservice>.fhir.azurehealthcareapis.com"

curl -X GET --header "Authorization: Bearer $token" $fhirservice/Patient

Access data in the FHIR service with curl script.

存取 DICOM 服務中的資料

$dicomservice="https://<dicomservice>.dicom.azurehealthcareapis.com"

curl -X GET --header "Authorization: Bearer $token" $dicomservice/changefeed?includemetadata=false

Access data in the DICOM service with curl script.

下一步

在本文中,您已瞭解如何使用 cURL 存取 Azure 健康資料服務資料。

若要瞭解如何在 Visual Studio Code 中使用 REST 用戶端延伸模組存取 Azure 健康資料服務資料,請參閱

FHIR® 是 HL7 的註冊商標,可與 HL7 的權限搭配使用。