删除自助服务策略
本文介绍如何更新自助服务策略。
先决条件
- 合作伙伴中心身份验证中所述的凭据。 此方案支持使用 Application+User 凭据进行身份验证。
C#
若要删除自助服务策略,请执行以下操作:
使用 实体标识符调用 IAggregatePartner.SelfServePolicies.ById 方法,以检索接口以对策略进行操作。
调用 Delete 或 DeleteAsync 方法以删除自助服务策略。
// IAggregatePartner partnerOperations;
string policyId;
// All the operations executed on this partner operation instance will share the same correlation Id but will differ in request Id
IPartner scopedPartnerOperations = partnerOperations.With(RequestContextFactory.Instance.Create(Guid.NewGuid()));
// deletes the self-serve policies
partnerOperations.SelfServePolicies.ById(policyId).Delete();
有关示例,请参阅以下内容:
- 示例: 控制台测试应用
- 项目: PartnerSDK.FeatureSamples
- 类: DeleteSelfServePolicies.cs
REST 请求
请求语法
方法 | 请求 URI |
---|---|
DELETE | {baseURL}/v1/SelfServePolicy/{id} HTTP/1.1 |
URI 参数
使用以下路径参数获取指定的产品。
名称 | 类型 | 必需 | 说明 |
---|---|---|---|
SelfServePolicy-id | 字符串 | 是 | 标识自助服务策略的字符串。 |
请求标头
- 需要请求 ID 和关联 ID。
- 有关详细信息,请参阅合作伙伴中心 REST 标头。
请求正文
无。
请求示例
DELETE https://api.partnercenter.microsoft.com/v1/SelfServePolicy/634f6379-ad54-449b-9821-564f737158ab_0431a72c-7d8a-4393-b25e-ef63f5efb415 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
X-Locale: en-US
Host: api.partnercenter.microsoft.com
Content-Length: 789
Connection: Keep-Alive
REST 响应
响应的成功和错误代码
每个响应都带有一个 HTTP 状态代码,用于指示成功或失败以及其他调试信息。 请使用网络跟踪工具来读取此代码、错误类型和其他参数。 如需完整列表,请参阅合作伙伴中心 REST 错误代码。
响应示例
HTTP/1.1 204 deleted
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
Date: Tue, 14 Feb 2017 20:06:02 GMT
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈