Help Center/
Content Moderation/
SDK Reference/
Using the .NET SDK/
SDK Calling Example/
Moderation (Video)/
Creating a Video Moderation Job
Updated on 2025-07-02 GMT+08:00
Creating a Video Moderation Job
- This section describes how to create a video moderation job using the video moderation SDK and AK/SK.
In the sample code, you can use withUrls of the RunCreateVideoModerationJobRequest class to configure the URL of the video to be reviewed (only the URL mode is supported). After the configuration is complete, run the code.
using System; using System.Collections.Generic; using HuaweiCloud.SDK.Core; using HuaweiCloud.SDK.Core.Auth; using HuaweiCloud.SDK.Moderation; using HuaweiCloud.SDK.Moderation.V3; using HuaweiCloud.SDK.Moderation.V3.Model; namespace RunCreateVideoModerationJobSolution { class Program { static void Main(string[] args) { //Hard-coded or plaintext AK and SK are risky. For security purposes, encrypt your AK and SK and store them in the configuration file or environment variables. //In this example, the AK and SK are stored in environment variables for identity authentication. Before running this example, configure environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. string ak= Environment.GetEnvironmentVariable("HUAWEICLOUD_SDK_AK", EnvironmentVariableTarget.Machine); string sk= Environment.GetEnvironmentVariable("HUAWEICLOUD_SDK_SK", EnvironmentVariableTarget.Machine); var config = HttpConfig.GetDefaultConfig(); config.IgnoreSslVerification = true; var auth = new BasicCredentials(ak, sk); var client = ModerationClient.NewBuilder() .WithCredential(auth) .WithRegion(ModerationRegion.ValueOf("xxx")) //Replace xxx with the region where the service is located. .WithHttpConfig(config) .Build(); var req = new RunCreateVideoModerationJobRequest { }; List<VideoCreateRequest.AudioCategoriesEnum> listAudioCategoriesbody = new List<VideoCreateRequest.AudioCategoriesEnum>(); listAudioCategoriesbody.Add(VideoCreateRequest.AudioCategoriesEnum.FromValue("porn")); List<VideoCreateRequest.ImageCategoriesEnum> listImageCategoriesbody = new List<VideoCreateRequest.ImageCategoriesEnum>(); listImageCategoriesbody.Add(VideoCreateRequest.ImageCategoriesEnum.FromValue("porn")); VideoCreateRequestData databody = new VideoCreateRequestData() { Url = "http://xxx.xx.xxxx", FrameInterval = 5.5 }; req.Body = new VideoCreateRequest() { Callback = "http://xxx.xx.xxxx", AudioCategories = listAudioCategoriesbody, ImageCategories = listImageCategoriesbody, EventType = VideoCreateRequest.EventTypeEnum.FromValue("default"), Data = databody }; try { var resp = client.RunCreateVideoModerationJob(req); var respStatusCode = resp.HttpStatusCode; Console.WriteLine(respStatusCode); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } } } }
- The console returns the submission result of the creation request and the video moderation job creation result.
200 { "request_id":"dbbcb75d1a174bfa899a38be38fdd107", "job_id":"xxx" }
Parent topic: Moderation (Video)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot