This topic describes how to use Content Moderation SDK for .NET to delete a business scenario. If you need to delete a business scenario, make sure that the business scenario is not in use. If you use a deleted business scenario, the moderation policy that is customized based on the business scenario becomes unavailable, and the default moderation policy is used. This may lead to errors in the moderation of business data.

Background information

For more information about parameters, see DeleteBizType.

Prerequisites

The dependencies for Content Moderation SDK for .NET are installed. For more information about how to install the dependencies, see Installation.
Note You must use the required versions of the dependencies described in the Installation topic. Otherwise, subsequent operation calls fail.

Delete a business scenario

Operation Description Supported region
DeleteBizType Deletes a business scenario.
  • cn-shanghai: China (Shanghai)
  • cn-beijing: China (Beijing)
  • cn-shenzhen: China (Shenzhen)
  • ap-southeast-1: Singapore (Singapore)

Sample code

using System;
using Newtonsoft.Json;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Http;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Green.Model.V20170823;
using System.Collections.Generic;


namespace csharp_sdk_sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Use the AccessKey ID and AccessKey secret of your Alibaba Cloud account. 
            IClientProfile profile = DefaultProfile.GetProfile(
                "cn-shanghai",
                "Your AccessKey ID",
                "Your AccessKey secret");
            DefaultAcsClient client = new DefaultAcsClient(profile);

            DeleteBizTypeRequest deleteBizTypeRequest = new DeleteBizTypeRequest();
            // Specify the name of the business scenario that you want to delete. 
            deleteBizTypeRequest.BizTypeName = "Name of the business scenario to be deleted";
            // Specify the response format of the operation. 
            deleteBizTypeRequest.AcceptFormat = FormatType.JSON;
            // Specify the request method. 
            deleteBizTypeRequest.Method = MethodType.POST;
            deleteBizTypeRequest.Encoding = "utf-8";

            try
            {
                DeleteBizTypeResponse response = client.GetAcsResponse(deleteBizTypeRequest);
                if (response.HttpResponse.Status != 200)
                {
                    Console.WriteLine("the request failed. status:{0}", response.HttpResponse.Status);
                }
                Console.WriteLine(System.Text.Encoding.Default.GetString(response.HttpResponse.Content));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed with error info: {0}", ex.Message);
            }
        }
    }
}