依照識別碼取得訂用帳戶
適用於:合作夥伴中心 |由 21Vianet 營運的合作夥伴中心 |美國政府Microsoft雲端合作夥伴中心
取得符合客戶標識碼和訂用帳戶標識碼的訂用帳戶資源。
必要條件
認證,如合作夥伴中心驗證所述。 此案例支援使用獨立應用程式和 App+使用者認證進行驗證。
客戶識別碼 (
customer-tenant-id
)。 如果您不知道客戶的標識碼,您可以在合作夥伴中心中選取 [客戶] 工作區,然後從客戶清單中查看客戶,然後從 [帳戶]。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶資訊] 區段中尋找Microsoft標識碼。 Microsoft 識別碼與客戶識別碼 (customer-tenant-id
) 相同。訂用帳戶標識碼。
C#
若要依標識碼取得訂用帳戶,請先呼叫 IAggregatePartner.Customers.ById 方法來取得訂用帳戶作業的介面,並使用客戶標識碼來識別客戶,以及用來識別訂用帳戶的 Subscriptions.ById 方法。 透過呼叫 Get,使用該介面來擷取訂用帳戶詳細數據。
// IAggregatePartner partnerOperations;
// string selectedCustomerId;
// string subscriptionID;
var subscriptionDetails = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(subscriptionID).Get();
範例: 控制台測試應用程式。 專案:合作夥伴中心 SDK 範例 類別:GetSubscription.cs
REST 要求
要求語法
方法 | 要求 URI |
---|---|
GET | {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription} HTTP/1.1 |
URI 參數
下表列出取得訂用帳戶所需的查詢參數。
名稱 | 類型 | 必要 | 描述 |
---|---|---|---|
customer-tenant-id | guid | Y | 對應至客戶的 GUID。 |
id-for-subscription | guid | Y | 對應至訂用帳戶的 GUID。 |
要求標頭
如需詳細資訊,請參閱合作夥伴中心 REST 標頭。
要求本文
無。
要求範例
GET https://api.partnercenter.microsoft.com/v1/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/A356AC8C-E310-44F4-BF85-C7F29044AF99 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 8f489776-a3f3-47cb-91c3-538e1f70f560
MS-CorrelationId: e72e1dc3-4abd-4ce0-908b-d23fdaedcb28
X-Locale: en-US
Host: api.partnercenter.microsoft.com
REST 回應
如果成功,這個方法會在回應本文中傳 回訂 用帳戶資源。
回應成功和錯誤碼
每個回應都隨附 HTTP 狀態碼,會指出成功與否以及其他的偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱合作夥伴中心的 REST 錯誤碼。
Microsoft Azure 訂用帳戶的回應範例
HTTP/1.1 200 OK
Content-Length: 833
Content-Type: application/json; charset=utf-8
MS-CorrelationId: e72e1dc3-4abd-4ce0-908b-d23fdaedcb28
MS-RequestId: 8f489776-a3f3-47cb-91c3-538e1f70f560
MS-CV: 7v11Wa//5EuGEo+A.0
MS-ServerId: 202010406
Date: Fri, 27 Jan 2017 21:51:40 GMT
{
"id": "A356AC8C-E310-44F4-BF85-C7F29044AF99",
"entitlementId": "42226ED6-070A-4E0F-B80C-4CDFB3E97AA7",
"offerId": "MS-AZR-0145P",
"offerName": "Microsoft Azure",
"friendlyName": "Microsoft Azure",
"quantity": 1,
"unitType": "Usage-based",
"creationDate": "2016-05-10T07:30:05.427Z",
"effectiveStartDate": "2016-05-10T00:00:00Z",
"commitmentEndDate": "9999-12-10T00:00:00Z",
"status": "active",
"autoRenewEnabled": false,
"billingType": "usage",
"contractType": "subscription",
"links": {
"offer": {
"uri": "/offers/MS-AZR-0145P?country=US",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/A356AC8C-E310-44F4-BF85-C7F29044AF99",
"method": "GET",
"headers": []
}
},
"orderId": "B23FDEDD-D6BD-415A-8B71-3624C81C9644",
"attributes": {
"etag": "eyJpZCI6ImEzNTZhYzhjLWUzMTAtNDRmNC1iZjg1LWM3ZjI5MDQ0YWY5OSIsInZlcnNpb24iOjJ9",
"objectType": "Subscription"
}
}
附加元件訂用帳戶的回應範例
附加元件訂用帳戶的回應包含本文和連結中的父訂用帳戶標識碼。
HTTP/1.1 200 OK
Content-Length: 1132
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 6eacec93-852d-4167-9d96-c57809bea7ed
MS-RequestId: 22bfd0fb-d1e6-4a8f-aa1a-124b7c820d80
MS-CV: cmde2DtbuUWi8JLq.0
MS-ServerId: 201022015
Date: Fri, 27 Jan 2017 00:12:53 GMT
{
"id": "968BA1CF-C146-4ADF-A300-308DCF718EEE",
"offerId": "2828BE95-46BA-4F91-B2FD-0BEF192ECF60",
"offerName": "Exchange Online Archiving for Exchange Online",
"friendlyName": "Some friendly name",
"quantity": 2,
"unitType": "Licenses",
"parentSubscriptionId": "1C2B75C1-74A5-472A-A729-7F8CEFC477F9",
"creationDate": "2017-01-25T23:01:08.693Z",
"effectiveStartDate": "2017-01-25T00:00:00Z",
"commitmentEndDate": "2018-02-10T00:00:00Z",
"commitmentEndDateTime": "2018-02-10T00:00:00Z",
"status": "active",
"autoRenewEnabled": true,
"billingType": "license",
"contractType": "subscription",
"links": {
"offer": {
"uri": "/offers/2828BE95-46BA-4F91-B2FD-0BEF192ECF60?country=US",
"method": "GET",
"headers": []
},
"parentSubscription": {
"uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/1C2B75C1-74A5-472A-A729-7F8CEFC477F9",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/968BA1CF-C146-4ADF-A300-308DCF718EEE",
"method": "GET",
"headers": []
}
},
"orderId": "CF3B0E37-BE0B-4CDD-B584-D1A97D98A922",
"attributes": {
"etag": "eyJpZCI6Ijk2OGJhMWNmLWMxNDYtNGFkZi1hMzAwLTMwOGRjZjcxOGVlZSIsInZlcnNpb24iOjF9",
"objectType": "Subscription"
}
}
新商務訂閱的回應範例
注意
授權型服務的新商務體驗包含許多新功能,並可供所有 雲端解決方案提供者 (CSP) 使用。 如需詳細資訊,請參閱 新的商務體驗概觀。
HTTP/1.1 200 OK
Content-Length: 1132
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 4ercec93-852d-4167-9d96-c57809bea7ed
MS-RequestId: 54sfd0fb-d1e6-4a8f-aa1a-124b7c820d80
MS-CV: cmde2DtbuUWi8JLq.0
MS-ServerId: 201022015
Date: Fri, 17 Nov 2023 00:14:53 GMT
{
"id": "e669812a-8920-452e-dd39-d5f20d61a1b1",
"offerId": "CFQ7TTC0LFLZ:0002:CFQ7TTC0MKD5",
"offerName": "Microsoft 365 E5",
"friendlyName": "Microsoft 365 E5",
"productType": {
"id": "OnlineServicesNCE",
"displayName": "OnlineServicesNCE"
},
"quantity": 1,
"unitType": "Licenses",
"hasPurchasableAddons": false,
"consumptionType": "overage",
"creationDate": "2023-11-28T22:28:50.7842638Z",
"effectiveStartDate": "2023-11-28T00:00:00Z",
"commitmentEndDate": "2023-12-27T00:00:00Z",
"commitmentEndDateTime": "2023-12-27T23:59:59Z",
"cancellationAllowedUntilDate": "2023-12-05T22:29:25.9967858Z",
"billingCycleEndDate": "2023-12-27T00:00:00Z",
"billingCycleEndDateTime": "2023-12-27T23:59:59Z",
"status": "active",
"autoRenewEnabled": true,
"isTrial": false,
"billingType": "license",
"billingCycle": "monthly",
"termDuration": "P1M",
"renewalTermDuration": "",
"refundOptions": [
{
"type": "Full",
"expiresAt": "2023-11-29T22:29:25.9967858Z"
}
],
"isMicrosoftProduct": true,
"partnerId": "",
"attentionNeeded": false,
"actionTaken": false,
"contractType": "subscription",
"links": {
"product": {
"uri": "/products/CFQ7TTC0LFLZ?country=US",
"method": "GET",
"headers": []
},
"sku": {
"uri": "/products/CFQ7TTC0LFLZ/skus/0002?country=US",
"method": "GET",
"headers": []
},
"availability": {
"uri": "/products/CFQ7TTC0LFLZ/skus/0002/availabilities/CFQ7TTC0MKD5?country=US",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/bfb6b398-c7f5-40f0-aa75-a1f1adf81374/subscriptions/e669812a-8920-452e-dd39-d5f20d61a1b1",
"method": "GET",
"headers": []
}
},
"publisherName": "Microsoft Corporation",
"orderId": "f9a896ba4686",
"attributes": {
"objectType": "Subscription"
}
}
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: