轉換訂用帳戶
適用于:合作夥伴中心 |由 21Vianet 營運的合作夥伴中心 |美國政府適用的 Microsoft Cloud 合作夥伴中心
將客戶的訂用帳戶升級至指定的目標訂用帳戶。
必要條件
認證,如合作夥伴中心驗證所述。 此案例支援使用獨立應用程式和 App+使用者認證進行驗證。
客戶識別碼 (
customer-tenant-id
)。 如果您不知道客戶的識別碼,您可以在合作夥伴中心 中選取 [客戶 ] 工作區,然後從客戶清單中查看客戶,然後 從 [帳戶 ]。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶資訊] 區段中尋找 Microsoft 識別碼 。 Microsoft 識別碼與客戶識別碼 (customer-tenant-id
) 相同。兩個訂用帳戶識別碼,一個用於初始訂用帳戶,另一個用於目標訂用帳戶。
GDAP 角色
您至少需要下列其中一個 GDAP 角色:
- 目錄讀取器或全域讀取器(僅限升級)
- 目錄寫入器(使用授權轉移升級)
C#
若要升級客戶的訂用帳戶,請先 取得客戶的訂用帳戶 。 然後,呼叫 Upgrades 屬性後面 接著 Get() 或 GetAsync() 方法來取得該訂用帳戶的升級清單。 從該升級清單中選擇目標升級,然後呼叫 初始訂用帳戶的 Upgrades 屬性,後面接著 Create() 方法。
// IAggregatePartner partnerOperations;
// string selectedCustomerId;
// string subscriptionIdForUpgrade;
// Upgrade targetOffer;
UpgradeResult upgradeResult = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(subscriptionIdForUpgrade).Upgrades.Create(targetOffer);
範例 : 主控台測試應用程式 。 專案 :PartnerSDK.FeatureSamples 類別 :UpgradeSubscription.cs
REST 要求
要求語法
方法 | 要求 URI |
---|---|
GET | {baseURL} /v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription}/upgrades HTTP/1.1 |
POST | {baseURL} /v1/customers/{customer-tenant-id}/subscriptions/{id-for-target}/upgrades HTTP/1.1 |
URI 參數
使用下列查詢參數來轉換訂用帳戶。
名稱 | 類型 | 必填 | 描述 |
---|---|---|---|
customer-tenant-id | guid | Y | 對應至客戶的 GUID。 |
id-for-subscription | guid | Y | 對應至初始訂用帳戶的 GUID。 |
id-for-target | guid | Y | 對應至目標訂用帳戶的 GUID。 |
要求標頭
如需詳細資訊,請參閱合作夥伴中心 REST 標頭。
要求本文
無
要求範例
GET https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription}/upgrades HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 18752a69-1aa1-4ef7-8f9d-eb3681b2d70a
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
X-Locale: en-US
POST https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions/{id-for-target}/upgrades HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 750fd5ea-904b-4c3e-b476-60d0feacab0d
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
X-Locale: en-US
Content-Type: application/json
Content-Length: 1098
Expect: 100-continue
{
"TargetOffer":{
"Id":"796B6B5F-613C-4E24-A17C-EBA730D49C02",
"Name":"Office 365 Enterprise E3",
"Description":"The best plan for businesses that need full productivity, communication and collaboration tools with the familiar Office suite, including Office Online.",
"MinimumQuantity":1,
"MaximumQuantity":10000000,
"Rank":61,
"Uri":"/3c95518e-8c37-41e3-9627-0ca339200f53/Offers/796B6B5F-613C-4E24-A17C-EBA730D49C02",
"Locale":"en-us",
"Country":"US",
"Category":{
"Id":"Enterprise_Key",
"Name":"Enterprise",
"Rank":20,
"Locale":"en-us",
"Country":"US",
"Attributes":{
"ObjectType":"OfferCategory"
}
},
"PrerequisiteOffers":[],
"IsAddOn":false,
"IsAvailableForPurchase":true,
"Billing":"license",
"IsAutoRenewable":true,
"Product":{
"Id":"6fd2c87f-b296-42f0-b197-1e91e994b900",
"Name":"Office 365 Enterprise E3",
"Unit":"Licenses"
},
"UnitType":"Licenses",
"Links":{
"LearnMore":{
"Uri":"http://g.microsoftonline.com/0BXPS00en/1015",
"Method":"GET",
"Headers":[]
}
}
"Attributes":{
"ObjectType":"Offer"
}
},
"UpgradeType":1,
"IsEligible":true,
"Quantity":1,
"UpgradeErrors":[],
"Attributes":{
"ObjectType":"Upgrade"
}
}
REST 回應
如果成功,這個方法會 傳迴響應本文中的升級 結果資源。
回應成功和錯誤碼
每個回應都隨附 HTTP 狀態碼,會指出成功與否以及其他的偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱錯誤碼。
回應範例
HTTP/1.1 200 OK
Content-Length: 138
Content-Type: application/json
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
MS-RequestId: 18752a69-1aa1-4ef7-8f9d-eb3681b2d70a
Date: Fri, 29 Jan 2016 20:42:26 GMT
{
"totalCount": 1,
"items": [{
"targetOffer": {
"id": "91FD106F-4B2C-4938-95AC-F54F74E9A239",
"name": "Office 365 Enterprise E1",
"description": "For businesses that need communication and collaboration tools and the ability to read and do lightweight editing of documents with Office Online.",
"minimumQuantity": 1,
"maximumQuantity": 10000000,
"rank": 48,
"uri": "/3c95518e-8c37-41e3-9627-0ca339200f53/Offers/91FD106F-4B2C-4938-95AC-F54F74E9A239",
"locale": "en-us",
"country": "US",
"category": {
"id": "Enterprise_Key",
"name": "Enterprise",
"rank": 20,
"locale": "en-us",
"country": "US",
"attributes": {
"objectType": "OfferCategory"
}
},
"prerequisiteOffers": [],
"isAddOn": false,
"isAvailableForPurchase": true,
"billing": "license",
"isAutoRenewable": true,
"isInternal": false,
"conversionTargetOffers": [],
"partnerQualifications": ["none"],
"product": {
"id": "18181a46-0d4e-45cd-891e-60aabd171b4e",
"name": "Office 365 Enterprise E1",
"unit": "Licenses"
},
"unitType": "Licenses",
"links": {
"learnMore": {
"uri": "http://g.microsoftonline.com/0BXPS00en/1013",
"method": "GET",
"headers": []
},
"self": {
"uri": "/offers/91FD106F-4B2C-4938-95AC-F54F74E9A239?country=US",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Offer"
}
},
"upgradeType": "upgrade_only",
"isEligible": false,
"quantity": 1,
"upgradeErrors": [{
"code": 2,
"description": "Subscription cannot be upgraded because the source subscription state is not active. Additional Details contains the current source subscription state.",
"attributes": {
"objectType": "UpgradeError"
}
}],
"attributes": {
"objectType": "Upgrade"
}
}],
"attributes": {
"objectType": "Collection"
}
}
HTTP/1.1 200 OK
Content-Length: 448
Content-Type: application/json
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
MS-RequestId: 750fd5ea-904b-4c3e-b476-60d0feacab0d
MS-CV: RnK86LBbDkWP/w2R.0
MS-ServerId: 102031201
Date: Fri, 29 Jan 2016 20:44:21 GMT
{
"sourceSubscriptionId":"896a2862-67e2-4f3d-bb3f-c50c42b5fad8",
"targetSubscriptionId":"2add8a55-454a-4ae5-a4c9-5107dc6e9768",
"upgradeType":1,
"upgradeErrors":[],
"licenseErrors":[],
"attributes":{
"objectType":"UpgradeResult"
}
}