Delete a self-serve policy

This article explains how to update a self-serve policy.

Prerequisites

C#

To delete a self-serve policy:

  1. Call the IAggregatePartner.SelfServePolicies.ById method with the entity identifier to retrieve an interface to operations on the policies.

  2. Call the Delete or DeleteAsync method to delete the self-serve policy.

// 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();

For an example, see the following:

  • Sample: Console test app
  • Project: PartnerSDK.FeatureSamples
  • Class: DeleteSelfServePolicies.cs

REST request

Request syntax

Method Request URI
DELETE {baseURL}/v1/SelfServePolicy/{id} HTTP/1.1

URI parameter

Use the following path parameters to get the specified product.

Name Type Required Description
SelfServePolicy-id string Yes A string that identifies the self-serve policy.

Request headers

Request body

None.

Request example

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 response

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Partner Center REST error codes.

Response example

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