The Delete Subscription operation deletes the specified subscription object.

Request

The Delete Subscription request may be specified as follows. Replace <subscription-id> with your offer ID

Method Request URI HTTP Version

DELETE

https://tenant-management.contoso.net/resourceproviders/<subscription-id>

HTTP/1.1

URI Parameters

None.

Request Headers

The following table describes request headers.

Request Header Description

Authorization

Specifies the credentials for this request. The value of this header must be set Negotiate <token>.

Request Body

None

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

The status code is embedded in the response for this operation; if successful, it will be status code 200 (OK).

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header Description

None

None

Response Body

None.

Example

Delete a subscription.

  Copy Code
public void DeleteSubscription(string tenantServiceEndpoint)
{
	HttpClient httpClient = new HttpClient();
	httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("BASIC", Convert.ToBase64String(UnicodeEncoding.Unicode.GetBytes("TenantPortal:" + ”password”)))));

	AdminSubscriptionList allSubscriptions = GetAllSubscriptions(tenantServiceEndpoint);
	foreach (AdminSubscription record in allSubscriptions)
	{
		if ((record.AccountAdminLiveEmailId == "test@test.com") && (record.OfferFriendlyName == "silver"))
		{
			//Console.WriteLine("true");
			string subscriptionEndpoint = adminServiceEndpoint + "subscriptions/" + record.SubscriptionID;
			var response = httpClient.DeleteAsync(subscriptionEndpoint);
			var resultsStr = response.Result.Content.ReadAsStringAsync().Result;
			Console.WriteLine(resultsStr + "\n Successfully deleted Subscription");
	}
}
}