共用方式為


擷取客戶的設定原則

適用于:合作夥伴中心

如何擷取指定客戶的指定設定原則。

必要條件

  • 認證,如合作夥伴中心驗證所述。 此案例支援使用獨立應用程式和 App+使用者認證進行驗證。

  • 客戶識別碼 (customer-tenant-id)。 如果您不知道客戶的識別碼,您可以選取 [客戶] 工作區,然後從客戶清單中選取客戶,然後從客戶清單中查閱該識別碼。 在客戶的 [帳戶] 頁面上,尋找 [客戶帳戶資訊] 區段中的 [Microsoft 識別碼] 。 Microsoft 識別碼與客戶識別碼 () customer-tenant-id 相同。

  • 原則識別碼。

C#

若要擷取指定客戶的設定原則,請先使用客戶識別碼呼叫 IAggregatePartner.Customers.ById 方法,以擷取指定客戶的作業介面。 接下來,使用原則識別碼呼叫 ConfigurationPolicies.ById 方法,以擷取指定原則之設定原則作業的介面。 最後,呼叫 GetGetAsync 方法來擷取設定原則。

IAggregatePartner partnerOperations;
string selectedCustomerId;
string selectedConfigurationPolicyId;

ConfigurationPolicy retrievedConfigurationPolicy =
    partnerOperations.Customers.ById(selectedCustomerId).ConfigurationPolicies.ById(selectedConfigurationPolicyId).Get();

範例主控台測試應用程式專案:合作夥伴中心 SDK 範例 類別:GetConfigurationPolicy.cs

REST 要求

要求的語法

方法 要求 URI
GET {baseURL}/v1/customers/{customer-id}/policies/{policy-id} HTTP/1.1

URI 參數

建立要求時,請使用下列路徑和查詢參數。

名稱 類型 必要 描述
customer-id string Yes 用來識別客戶的 GUID 格式字串。
policy-id string Yes 識別原則的 GUID 格式字串。

要求標頭

如需詳細資訊,請參閱合作夥伴中心 REST 標頭

要求本文

要求範例

GET https://api.partnercenter.microsoft.com/v1/customers/47021739-3426-40bf-9601-61b4b6d7c793/policies/56edf752-ee77-4fd8-b7f5-df1f74a3a9ac HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: e88d014d-ab70-41de-90a0-f7fd1797267d
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Content-Length: 0
Host: api.partnercenter.microsoft.com

REST 回應

如果成功,回應會包含要求的 ConfigurationPolicy 資源。

回應成功和錯誤碼

每個回應都隨附 HTTP 狀態碼,會指出成功與否以及其他的偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱合作夥伴中心的 REST 錯誤碼

回應範例

HTTP/1.1 200 OK
Content-Length: 443
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-RequestId: ab3abfe7-dce7-46c0-ab20-4fd49bc3e2f7
MS-CV: YrLe3w6BbUSMt1fi.0
MS-ServerId: 030020344
Date: Tue, 25 Jul 2017 18:08:27 GMT

{
    "id": "56edf752-ee77-4fd8-b7f5-df1f74a3a9ac",
    "name": "Test policy",
    "category": "o_o_b_e",
    "description": "Test policy creation from API 1",
    "devicesAssigned": 0,
    "policySettings": ["skip_express_settings"],
    "createdDate": "2017-07-25T11:03:03.8457116-07:00",
    "lastModifiedDate": "2017-07-25T11:04:00.8149974-07:00",
    "attributes": {
        "objectType": "ConfigurationPolicy"
    }
}