更新商业市场订阅或新的商业订阅或软件订阅的自动更新
适用于:合作伙伴中心
注意
基于许可证的服务的新商业体验涵盖许多新功能,可供所有云解决方案提供商 (CSP) 使用。 有关详细信息,请参阅新商业体验概述。
更新与客户和订阅 ID 匹配的商业市场、新商务或软件 订阅 资源的 autorenew 属性。
在合作伙伴中心,首先选择 客户来执行此操作。 然后,选择要更新的订阅。 最后,切换 “自动续订 ”选项,然后选择“ 提交”。
先决条件
合作伙伴中心身份验证中所述的凭据。 此方案支持使用独立应用和 App+User 凭据进行身份验证。
客户 ID (
customer-tenant-id
)。 如果不知道客户的 ID,可以在合作伙伴中心查找它。 从主页选择 “客户 ”,然后从客户列表中选择客户,然后选择“ 帐户”。 在客户的“帐户”页上,在“客户帐户信息”部分查找Microsoft ID。 Microsoft ID 与客户 ID 相同。customer-tenant-id
”订阅 ID。
C#
若要更新客户的订阅,请先获取订阅,然后设置订阅的 autoRenewEnabled 属性。 更改后,使用 IAggregatePartner.Customers 集合并调用 ById() 方法。 然后调用 Subscriptions 属性,后跟 ById() 方法。 然后,通过调用 Patch() 方法完成。
// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// Subscription selectedSubscription;
// turn off auto renew.
selectedSubscription.AutoRenewEnabled = false;
var updatedSubscription = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(selectedSubscription.Id).Patch(selectedSubscription);
示例: 控制台测试应用。 项目:PartnerSDK.FeatureSample 类:UpdateSubscription.cs
REST 请求
请求语法
方法 | 请求 URI |
---|---|
PATCH | {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 标头。
请求正文
请求正文中需要有一个完整的订阅资源。 确保 已更新 AutoRenewEnabled 属性。
商业市场订阅的请求示例
PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<id-for-subscription> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3831
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
If-Match: <etag>
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive
{
"id": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"offerId": "DZH318Z0BXWC:0001:DZH318Z0BMJX",
"offerName": "offer Name",
"friendlyName": "friendly Name",
"quantity": 1,
"unitType": "License(s)",
"hasPurchasableAddons": false,
"creationDate": "2019-01-04T01:00:12.6647304Z",
"effectiveStartDate": "2019-01-09T00:21:45.9263727+00:00",
"commitmentEndDate": "2019-02-08T00:21:45.9263727+00:00",
"status": "active",
"autoRenewEnabled": false,
"isTrial": false,
"billingType": "license",
"billingCycle": "monthly",
"termDuration": "P1M",
"refundOptions": [{
"type": "Full",
"expiresAt": "2019-01-10T00:21:45.9263727+00:00"
}],
"isMicrosoftProduct": false,
"partnerId": "",
"contractType": "subscription",
"publisherName": "publisher Name",
"orderId": "ImxjLNL4_fOc-2KoyOxGTZcrlIquzls11",
"attributes": {"objectType": "Subscription"},
}
新商务订阅的请求示例
注意
基于许可证的服务的新商业体验涵盖许多新功能,可供所有云解决方案提供商 (CSP) 使用。 有关详细信息,请参阅新商业体验概述。
PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<id-for-subscription> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3831
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
If-Match: <etag>
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive
{
"id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"offerId": "CFQ7TTC0LH18:0001:CFQ7TTC0K971",
"offerName": "Microsoft 365 Business Basic",
"friendlyName": "Microsoft 365 Business Basic",
"productType": {
"id": "OnlineServicesNCE",
"displayName": "OnlineServicesNCE"
},
"quantity": 1,
"unitType": "Licenses",
"hasPurchasableAddons": false,
"creationDate": "2021-01-14T16:57:15.0966728Z",
"effectiveStartDate": "2021-01-14T16:57:14.498252Z",
"commitmentEndDate": "2022-01-13T00:00:00Z",
"status": "active",
"autoRenewEnabled": false, // original value = true
"isTrial": false,
"billingType": "license",
"billingCycle": "monthly",
"termDuration": "P1Y",
"renewalTermDuration": "",
"refundOptions": [
{
"type": "Full",
"expiresAt": "2021-01-15T00:00:00Z"
}
],
"isMicrosoftProduct": true,
"partnerId": "",
"attentionNeeded": false,
"actionTaken": false,
"contractType": "subscription",
"links": {
"product": {
"uri": "/products/CFQ7TTC0LH18?country=US",
"method": "GET",
"headers": []
},
"sku": {
"uri": "/products/CFQ7TTC0LH18/skus/0001?country=US",
"method": "GET",
"headers": []
},
"availability": {
"uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0K971?country=US",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/d8202a51-69f9-4228-b900-d0e081af17d7/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"method": "GET",
"headers": []
}
},
"publisherName": "Microsoft Corporation",
"orderId": "34b37d7340cc",
"attributes": {
"objectType": "Subscription"
}
}
REST 响应
如果成功,此方法在响应正文中返回更新 的订阅 资源属性。
响应的成功和错误代码
每个响应都带有一个 HTTP 状态代码,用于指示成功或失败以及其他调试信息。 请使用网络跟踪工具来读取此代码、错误类型和其他参数。 有关完整列表,请参阅错误代码。
响应示例
HTTP/1.1 200 OK
Content-Length: 1322
Content-Type: application/json; charset=utf-8
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3831
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
{
"id": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"offerId": "DZH318Z0BXWC:0001:DZH318Z0BMJX",
"offerName": "offer Name",
"friendlyName": "friendly Name",
"quantity": 1,
"unitType": "License(s)",
"hasPurchasableAddons": false,
"creationDate": "2019-01-04T01:00:12.6647304Z",
"effectiveStartDate": "2019-01-09T00:21:45.9263727+00:00",
"commitmentEndDate": "2019-02-08T00:21:45.9263727+00:00",
"status": "active",
"autoRenewEnabled": false,
"isTrial": false,
"billingType": "license",
"billingCycle": "monthly",
"termDuration": "P1M",
"refundOptions": [
{
"type": "Full",
"expiresAt": "2019-01-10T00:21:45.9263727+00:00"
}
],
"isMicrosoftProduct": false,
"partnerId": "",
"contractType": "subscription",
"links": {
"product": {
"uri": "/products/DZH318Z0BXWC?country=US",
"method": "GET",
"headers": []
},
"sku": {
"uri": "/products/DZH318Z0BXWC/skus/0001?country=US",
"method": "GET",
"headers": []
},
"availability": {
"uri": "/products/DZH318Z0BXWC/skus/0001/availabilities/DZH318Z0BMJX?country=US",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/5921f00a-32c0-4457-aaa1-e8018c650895/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"method": "GET",
"headers": []
}
},
"publisherName": "publishe rName",
"orderId": "ImxjLNL4_fOc-2KoyOxGTZcrlIquzls11",
"attributes": {
"etag": "",
"objectType": "Subscription"
}
}