共用方式為


Sensors - Get Connection String

取得感測器 連接字串。

GET {endpoint}/sensor-partners/{sensorPartnerId}/sensors/{sensorId}/connection-strings?api-version=2023-11-01-preview

URI 參數

名稱 位於 必要 類型 Description
endpoint
path True

string

uri

命名空間的主機名,例如 admaInstanceName.farmbeats.azure.net

sensorId
path True

string

感測器資源的標識碼。

sensorPartnerId
path True

string

感測器合作夥伴的標識碼。

api-version
query True

string

要求的 API 版本

要求標頭

名稱 必要 類型 Description
Authorization True

string

請為授權的 API 呼叫提供有效的持有人令牌。 請注意,如果您之前嘗試了未驗證的呼叫,您可能需要清除瀏覽器快取。

回應

名稱 類型 Description
200 OK

IoTHubDeviceAuthentication

成功

Other Status Codes

ErrorResponse

[錯誤]

Headers

x-ms-error-code: string

安全性

Authorization

請為授權的 API 呼叫提供有效的持有人令牌。 請注意,如果您之前嘗試了未驗證的呼叫,您可能需要清除瀏覽器快取。

Type: apiKey
In: header

範例

Sensors_GetConnectionString

Sample Request

GET {endpoint}/sensor-partners/sp1/sensors/s124/connection-strings?api-version=2023-11-01-preview

Sample Response

{
  "primaryDeviceConnectionString": "HostName=iothubName.azure-devices.net;DeviceId=809f4379-b4d3-de01-6425-f088de6645f5;SharedAccessKey=****",
  "secondaryDeviceConnectionString": "HostName=iothubName.azure-devices.net;DeviceId=809f4379-b4d3-de01-6425-f088de6645f5;SharedAccessKey=****"
}

定義

名稱 Description
Error

來自 Azure AgPlatform 服務的錯誤。

ErrorResponse

來自 Azure AgPlatform 服務的錯誤回應。 請參閱 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 參考檔。

InnerError

包含錯誤清單的內部錯誤。請參閱 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object InnerError 參考檔。

IoTHubDeviceAuthentication

透過 連接字串 到IoTHub裝置的驗證。

Error

來自 Azure AgPlatform 服務的錯誤。

名稱 類型 Description
code

string

伺服器定義的錯誤碼集。

details

Error[]

導致此錯誤之特定錯誤的詳細數據陣列。

innererror

InnerError

包含錯誤清單的內部錯誤。請參閱 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object InnerError 參考檔。

message

string

人類可閱讀的錯誤表示法。

target

string

錯誤的目標。

ErrorResponse

來自 Azure AgPlatform 服務的錯誤回應。 請參閱 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 參考檔。

名稱 類型 Description
error

Error

來自 Azure AgPlatform 服務的錯誤。

traceId

string

唯一追蹤標識碼。

InnerError

包含錯誤清單的內部錯誤。請參閱 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object InnerError 參考檔。

名稱 類型 Description
code

string

包含錯誤所提供的特定錯誤碼。

innererror

InnerError

包含錯誤清單的內部錯誤。請參閱 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object InnerError 參考檔。

IoTHubDeviceAuthentication

透過 連接字串 到IoTHub裝置的驗證。

名稱 類型 Description
primaryDeviceConnectionString

string

ioTHub 裝置的主要 連接字串。

secondaryDeviceConnectionString

string

ioTHub 裝置的次要 連接字串。