适用于:合作伙伴中心 |由世纪互联运营的合作伙伴中心 |美国政府Microsoft云合作伙伴中心
本文介绍如何获取客户选择添加到其 订阅 资源的附加组件集合。
先决条件
合作伙伴中心身份验证中所述的凭据。 此方案支持使用独立应用和 App+User 凭据进行身份验证。
客户编号 (
customer-tenant-id
)。 如果不知道客户的 ID,可以在合作伙伴中心查找,依次选择“客户”工作区,从客户列表中选择客户,然后选择“帐户”。 在客户的“帐户”页上,在“客户帐户信息”部分查找Microsoft ID。 Microsoft ID 与客户 ID (customer-tenant-id
) 相同。订阅标识符。
C#(编程语言)
要获取客户订阅的附加组件列表,请执行以下作:
使用 IAggregatePartner.Customers 集合调用 ById() 方法。
调用 Addons 属性,后跟 Get() 或 GetAsync()。
// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// var selectedSubscription Subscription;
var subscriptionDetails = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(selectedSubscription.Id).AddOns.Get();
有关示例,请参阅以下内容:
- 示例:控制台测试应用
- 项目名称: PartnerSDK.FeatureSample
- 类: SubscriptionAddons.cs
REST 请求
请求语法
方法 | 请求 URI |
---|---|
获取 | {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription}/addons HTTP/1.1 |
URI 参数
下表列出了获取订阅的附加组件列表所需的查询参数。
名称 | 类型 | 必选 | DESCRIPTION |
---|---|---|---|
customer-tenant-id | guid | Y | 与客户相对应的 GUID。 |
id-for-subscription 订阅 | guid | Y | 与订阅相对应的 GUID。 |
请求标头
有关详细信息,请参阅合作伙伴中心 REST 标头。
请求主体
没有。
请求示例
GET https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<id-for-subscription>/addons HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 429902e2-ea2f-4704-b8a0-27fc53c539ba
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
REST 响应
如果成功,此方法将在响应正文中返回一组资源。
成功响应和错误代码
每个响应都附带一个 HTTP 状态代码,指示成功或失败和其他调试信息。 请使用网络跟踪工具来读取此代码、错误类型和其他参数。 有关完整列表,请参阅 错误代码。
响应示例
HTTP/1.1 200 OK
Content-Length: 73754
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 16fee928-dc2c-412f-adbb-871f68babf16
Date: Wed, 25 Nov 2015 05:50:45 GMT
{
"totalCount": 37,
"items": [{
"id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
"entitlementId": "42226ed6-070a-4e0f-b80c-4cdfB3e97aa7",
"friendlyName": "Myofferpurchase",
"quantity": 1,
"unitType": "none",
"creationDate": "2015-11-25T06: 41: 12Z",
"effectiveStartDate": "2015-11-24T08: 00: 00Z",
"commitmentEndDate": "2016-12-12T08: 00: 00Z",
"status": "active",
"autoRenewEnabled": false,
"billingType": "none",
"contractType": "subscription",
"links": {
"offer": {
"uri": "/v1/offers/0CCA44D6-68E9-4762-94EE-31ECE98783B9",
"method": "GET",
"headers": []
},
"self": {
"uri": "/subscriptions?key=<key>",
"method": "GET",
"headers": []
}
},
"orderId": "6183db3d-6318-4e52-877e-25806e4971be",
"attributes": {
"etag": "<etag>",
"objectType": "Subscription"
}
}],
"attributes": {
"objectType": "Collection"
}
}