共用方式為


取得自助原則的清單

取得資源集合,表示實體的自助原則。

必要條件

C#

若要取得所有自助原則的清單:

  1. 使用實體識別碼呼叫 IAggregatePartner.With (IRequestCoNtext) 方法來擷取原則作業的介面。
// IAggregatePartner partnerOperations;

// All the operations executed on this partner operation instance will share the same correlation Id but will differ in request Id
IPartner scopedPartnerOperations = partnerOperations.With(RequestContextFactory.Instance.Create(Guid.NewGuid()));

// gets the self-serve policies
var SelfServePolicies = scopedPartnerOperations.SelfServePolicies.Get(customerIdAsEntity);

如需範例,請參閱下列各項:

REST 要求

要求的語法

方法 要求 URI
GET {baseURL}/v1/SelfServePolicy?entity_id={entity_id} HTTP/1.1

URI 參數

使用下列查詢參數來取得客戶清單。

名稱 類型 必要 描述
entity_id string Y 要求存取權的實體識別碼。 這會是客戶的租使用者識別碼。

要求標頭

如需詳細資訊,請參閱 標頭

要求本文

無。

要求範例

GET https://api.partnercenter.microsoft.com/v1/SelfServePolicy?entity_id=0431a72c-7d8a-4393-b25e-ef63f5efb415 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 3705fc6d-4127-4a87-bdba-9658f73fe019
MS-CorrelationId: b12260fb-82de-4701-a25f-dcd367690645

REST 回應

如果成功,這個方法會在回應本文中傳回 SelfServePolicy 資源的集合。

回應成功和錯誤碼

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

回應範例

HTTP/1.1 200 OK
Content-Length: 15650
Content-Type: application/json
MS-CorrelationId: b12260fb-82de-4701-a25f-dcd367690645
MS-RequestId: 3705fc6d-4127-4a87-bdba-9658f73fe019
Date: Fri, 20 Nov 2015 01:08:23 GMT

{
    "totalCount": 1,
    "items": [{
        "id": "634f6379-ad54-449b-9821-564f737158ab_0431a72c-7d8a-4393-b25e-ef63f5efb415",
        "selfServeEntity": {
            "selfServeEntityType": "customer",
            "tenantID": "0431a72c-7d8a-4393-b25e-ef63f5efb415"
        },
        "grantor": {
            "grantorType": "billToPartner",
            "tenantID": "634f6379-ad54-449b-9821-564f737158ab"
        },
        "permissions": [
            {
                "resource": "AzureReservedInstances",
                "action": "Purchase"
            },
            {
                "resource": "AzureSavingsPlan",
                "action": "Purchase"
            }
        ],
        "attributes": {
            "etag": "\"933523d1-3f63-4fc3-8789-5e21c02cdaed\"",
            "objectType": "SelfServePolicy"
        }
    }],
    "attributes": {
        "objectType": "Collection"
    }
}