適用於:合作夥伴中心 |由 21Vianet 營運的合作夥伴中心 |美國政府Microsoft雲端合作夥伴中心
小提示
此 API 使您能夠僅修改舊訂閱的計費頻率。
要修改新商業體驗 (NCE) 訂閱 和 舊版訂閱的計費頻率,您可以使用 按 ID 更新訂閱 - 合作夥伴應用開發人員 |Microsoft 學習 API。
將 Order 從按月計費更新為按年計費,或從按年計費更新為按月計費。
在合作夥伴中心,可以通過導航到客戶的訂閱詳細資訊頁來執行此作。 在那裡,您將看到一個定義訂閱當前計費週期的選項,並能夠更改和提交訂閱。
超出本文的範圍 :
- 更改試用版的計費週期
- 更改任何非年度期限優惠(月度,六年)和Azure訂閱的計費週期
- 更改非活動訂閱的計費週期
- 更改 Microsoft Online Services 基於許可證的訂閱的計費週期
先決條件
合作夥伴中心身份驗證中所述的憑證。 此案例支援使用獨立應用程式和 App+使用者認證進行驗證。
客戶識別碼 (
customer-tenant-id)。 如果您不知道客戶的標識碼,您可以在 合作夥伴中心 中選取 [客戶] 工作區,然後從客戶清單中找到該客戶,接著選取 [帳戶]。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶資訊] 區段中尋找 Microsoft ID。 Microsoft ID 與客戶 ID (customer-tenant-id) 相同。訂單標識碼。
C#
若要更改計費週期的頻率,請更新 Order.BillingCycle 屬性。
// IAggregatePartner partnerOperations;
// string customerId;
// string offerId;
// string orderId;
var order = new Order()
{
ReferenceCustomerId = customerId,
BillingCycle = BillingCycleType.Annual,
LineItems = new List<OrderLineItem>()
{
new OrderLineItem()
{
LineItemNumber = 0,
OfferId = offerId,
SubscriptionId = "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
Quantity = 1
}
}
};
var createdOrder = partnerOperations.Customers.ById(customerId).Orders.ById(orderId).Patch(order);
REST 要求
請求語法
| 方法 | 請求網址識別碼 (URI) |
|---|---|
| 補丁 | {baseURL}/v1/customers/{customer-tenant-id}/orders/{order-id} HTTP/1.1 |
URI 參數
下表列出變更訂用帳戶數量所需的查詢參數。
| 名稱 | 類型 | 為必填項目 | 說明 |
|---|---|---|---|
| 客戶租戶識別碼 (customer-tenant-id) | GUID(國際唯一識別碼) | 是 | 用於標識客戶的 GUID 格式的 customer-tenant-id |
| 訂單編號 | GUID(國際唯一識別碼) | 是 | 訂單標識碼 |
請求標頭
如需詳細資訊,請參閱合作夥伴中心 REST 標頭。
請求主體
下表描述了請求正文中的屬性。
訂單
| 房產 | 類型 | 為必填項目 | 說明 |
|---|---|---|---|
| 身份識別碼 | 字符串 | N | 成功創建訂單時提供的訂單標識碼 |
| 參考客戶ID | 字符串 | 是 | 客戶標識碼 |
| 計費週期 | 字符串 | 是 | 指出合作夥伴為此訂單計費的頻率。 支援的值是 BillingCycleType中找到的成員名稱。 |
| LineItems (行專案) | 物件陣列 | 是 | OrderLineItem 資源的數位 |
| 創建日期 | 日期時間 | N | 訂單的創建日期,採用日期時間格式 |
| 屬性 | 物體 | N | 包含 “ObjectType”: “OrderLineItem” |
訂單項目
| 房產 | 類型 | 為必填項目 | 說明 |
|---|---|---|---|
| LineItemNumber | 數字 | 是 | 行項目編號,從 0 開始 |
| 優惠識別碼 | 字符串 | 是 | 選件的ID |
| SubscriptionId (訂閱識別碼) | 字符串 | 是 | 訂用帳戶的標識碼 |
| 友善名稱 | 字符串 | N | 合作夥伴定義的訂閱的友好名稱,以説明消除歧義 |
| 數量 | 數字 | 是 | 授權或實例數目 |
| 合作夥伴IdOnRecord | 字符串 | N | 記錄合作夥伴的 PartnerID |
| 屬性 | 物體 | N | 包含 “ObjectType”: “OrderLineItem” |
範例請求
更新為年度計費
PATCH https://api.partnercenter.microsoft.com/v1/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/orders/CF3B0E37-BE0B-4CDD-B584-D1A97D98A922 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 17a2658e-d2cc-439b-a2f0-2aefd9344fbc
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Content-Length: 414
Expect: 100-continue
{
"Id": null,
"ReferenceCustomerId": "4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04",
"BillingCycle" : "Annual",
"LineItems": [{
"LineItemNumber": 0,
"OfferId": "2828BE95-46BA-4F91-B2FD-0BEF192ECF60",
"SubscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"FriendlyName": "Some friendly name",
"Quantity": 2,
"PartnerIdOnRecord": null,
"Attributes": {
"ObjectType": "OrderLineItem"
}
}
],
"CreationDate": null,
"Attributes": {
"ObjectType": "Order"
}
}
REST 響應
如果成功,此方法將在回應正文中返回更新的訂閱順序。
回應成功和錯誤碼
每個回應都有一個 HTTP 狀態代碼,指出成功或失敗和其他偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱錯誤代碼。
回應範例
HTTP/1.1 200 OK
Content-Length: 1135
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 17a2658e-d2cc-439b-a2f0-2aefd9344fbc
MS-CV: WtFy3zI8V0u2lnT9.0
MS-ServerId: 020021921
Date: Wed, 25 Jan 2017 23:01:08 GMT
{
"id": "cf3b0e37-be0b-4cdd-b584-d1a97d98a922",
"referenceCustomerId": "4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04",
"billingCycle": "Annual",
"lineItems": [{
"lineItemNumber": 0,
"offerId": "195416C1-3447-423A-B37B-EE59A99A19C4",
"subscriptionId": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"friendlyName": "new offer purchase",
"quantity": 5,
"links": {
"subscription": {
"uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"method": "GET",
"headers": []
}
}
},
{
"lineItemNumber": 1,
"offerId": "2828BE95-46BA-4F91-B2FD-0BEF192ECF60",
"subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"friendlyName": "Some friendly name",
"quantity": 2,
"links": {
"subscription": {
"uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"method": "GET",
"headers": []
}
}
}
],
"creationDate": "2017-01-25T14:53:12.093-08:00",
"links": {
"self": {
"uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/orders/cf3b0e37-be0b-4cdd-b584-d1a97d98a922",
"method": "GET",
"headers": []
}
},
"attributes": {
"etag": "eyJpZCI6ImNmM2IwZTM3LWJlMGItNGNkZC1iNTg0LWQxYTk3ZDk4YTkyMiIsInZlcnNpb24iOjJ9",
"objectType": "Order"
}
}