创建人工评审 (REST)Create human reviews (REST)

审阅存储并显示供人工审查方评估的内容。Reviews store and display content for human moderators to assess. 当用户完成评审时,系统会将结果发送到指定的回调终结点。When a user completes a review, the results are sent to a specified callback endpoint. 在本指南中,你将了解如何通过 API 控制台使用评审 REST API 来设置评审。In this guide, you'll learn how to set up reviews using the review REST APIs through the API console. 了解 API 的结构后,可以轻松将这些调用移植到任何与 REST 兼容的平台。Once you understand the structure of the APIs, you can easily port these calls to any REST-compatible platform.

先决条件Prerequisites

  • 在内容审查器审阅工具站点上登录或创建帐户。Sign in or create an account on the Content Moderator Review tool site.

创建评审Create a review

若要创建评审,请转到评审 - 创建 API 参考页并选择你的键区域的按钮(可以在评审工具的“凭据”页上的终结点 URL 中找到此项)**** ****。To create a review, go to the Review - Create API reference page and select the button for your key region (you can find this in the Endpoint URL on the Credentials page of the Review tool). 这将启动 API 控制台,你可以在其中轻松构造和运行 REST API 调用。This starts the API console, where you can easily construct and run REST API calls.

“评审 - 获取”区域选择

输入 REST 调用参数Enter REST call parameters

输入“teamName”和“Ocp-Apim-Subscription-Key”的值**** ****:Enter values for teamName, and Ocp-Apim-Subscription-Key:

  • teamName:设置审阅工具帐户时创建的团队 ID(位于审阅工具的“凭据”屏幕的“ID”**** 字段中)。teamName: The team ID that you created when you set up your Review tool account (found in the Id field on your Review tool's Credentials screen).
  • Ocp-Apim-Subscription-Key:内容审查器密钥。Ocp-Apim-Subscription-Key: Your Content Moderator key. 可以在审阅工具的“设置”**** 选项卡上找到它。You can find this on the Settings tab of the Review tool.

输入评审定义Enter a review definition

编辑“请求正文”框,通过以下字段输入 JSON 请求****:Edit the Request body box to enter the JSON request with the following fields:

  • 元数据:要返回到回调终结点的自定义键值对。Metadata: Custom key-value pairs to be returned to your callback endpoint. 如果此键是评审工具中定义的短代码,则显示为标记。If the key is a short code that is defined in the Review tool, it appears as a tag.
  • 内容:对于图像和视频内容,这是指向内容的 URL 字符串。Content: In the case of Image and Video content, this is a URL string pointing to the content. 对于文本内容,这是实际的文本字符串。For text content, this is the actual text string.
  • ContentId:自定义标识符字符串。ContentId: A custom identifier string. 此字符串将传递给 API,并通过回调返回。This string is passed to the API and returned through the callback. 它在关联内部标识符或元数据与审查作业结果时十分有用。It is useful for associating internal identifiers or metadata with the results of a moderation job.
  • CallbackEndpoint:(可选)在评审完成时用于接收回调信息的 URL。CallbackEndpoint: (Optional) The URL to receive callback information when the review is completed.

默认请求正文显示了可以创建的不同类型评审的示例:The default request body shows examples of the different types of reviews you can create:

[Image]
[
  {
    "Metadata": [
      {
        "Key": "string",
        "Value": "string"
      }
    ],
    "Type": "Image",
    "Content": "<Content Url>",
    "ContentId": "<Your identifier for this content>",
    "CallbackEndpoint": "<Url where you would receive callbacks>"
  }
]
[Text]
[
  {
    "Metadata": [
      {
        "Key": "string",
        "Value": "string"
      }
    ],
    "Type": "Text",
    "Content": "<Your Text Content>",
    "ContentId": "<Your identifier for this content>",
    "CallbackEndpoint": "<Url where you would receive callbacks>"
  }
]
[Video]
[
  {
    "VideoFrames":[
      {
          "Id": "<Frame Id>",
          "Timestamp": "<Frame Timestamp",
          "FrameImage":"<Frame Image URL",
          "Metadata": [
            {
              "Key": "<Key>",
              "Value": "<Value"
            }
          ],
          "ReviewerResultTags": [
          ]
    ], 
    "Metadata": [
      {
        "Key": "string",
        "Value": "string"
      },
      //For encrypted Videos
        {
          "Key": "protectedType",
          "Value": "AES or FairPlay or Widevine or Playready"
        },
        {
          "Key": "authenticationToken",
          "Value": "your viewtoken(In case of Video Indexer AES encryption type, this value is viewtoken from breakdown json)"
        },
      //For FairPlay encrypted type video include certificateUrl as well
        {
          "Key": "certificateUrl",
          "Value": "your certificate url"
        }
    ],
    "Type": "Video",
    "Content": "<Stream Url>",
    "ContentId": "<Your identifier for this content>",
    "CallbackEndpoint": "<Url where you would receive callbacks>",
    [Optional]
    "Timescale": "<Timescale of the video>
  }
]

提交请求Submit your request

选择“发送”。****Select Send. 如果该操作成功,“响应状态”将为 200 OK,且“响应内容”框显示评审的 ID**** ****。If the operation succeeds, the Response status is 200 OK, and the Response content box displays an ID for the review. 复制此 ID,然后在以下步骤中使用它。Copy this ID to use in the following steps.

审查 - 创建控制台响应内容框显示审查 ID

检查新评审Examine the new review

评审工具中,选择“评审” > “图像”/“文本”/“视频”(取决于所使用的内容)**** **** **** ****。In the Review tool, select Review > Image/Text/Video (depending on what content you used). 现在,上传的内容应已显示,可供人工评审。The content that you uploaded should appear, ready for human review.

足球的审查工具图像

获取评论详细信息Get review details

若要检索有关现有审阅的详细信息,请转到评审 - 获取 API 参考页,并选择代表你的区域(管理键的区域)的按钮。To retrieve details about an existing review, go to the Review - Get API reference page and select the button for your region (the region in which your key is administered).

“工作流 - 获取”区域选择

按以上所述输入 REST 调用参数。Enter the REST call parameters as in the above section. 对于此步骤,reviewId 是创建评审时收到的唯一 ID 字符串****。For this step, reviewId is the unique ID string you received when you created the review.

审查 - 创建控制台获取结果

选择“发送”。****Select Send. 如果操作成功,“响应状态”为 200 OK,“响应内容”框将以 JSON 格式显示评审详细信息,如下所示**** ****:If the operation succeeds, the Response status is 200 OK, and the Response content box displays the review details in JSON format, like the following:

{  
  "reviewId":"201712i46950138c61a4740b118a43cac33f434",
  "subTeam":"public",
  "status":"Complete",
  "reviewerResultTags":[  
    {  
      "key":"a",
      "value":"False"
    },
    {  
      "key":"r",
      "value":"True"
    },
    {  
      "key":"sc",
      "value":"True"
    }
  ],
  "createdBy":"<teamname>",
  "metadata":[  
    {  
      "key":"sc",
      "value":"true"
    }
  ],
  "type":"Image",
  "content":"https://reviewcontentprod.blob.core.chinacloudapi.cn/<teamname>/IMG_201712i46950138c61a4740b118a43cac33f434",
  "contentId":"0",
  "callbackEndpoint":"<callbackUrl>"
}

记下响应中的以下字段:Take note of the following fields in the response:

  • statusstatus
  • reviewerResultTags:如果有标记是由人工评审团队手动添加的(通过“createdBy”字段指示),会出现该字段****。reviewerResultTags: This appears if any tags have been manually added by the human review team (shown the createdBy field).
  • metadata:该字段显示,在人工评审团队更改之前,最初添加到评审中的标记。metadata: This shows the tags that were initially added in the review, before the human review team made changes.

后续步骤Next steps

在本指南中,你了解了如何使用 REST API 创建内容审查评审。In this guide, you learned how to create content moderation reviews using the REST API. 接下来,将评审集成到端到端的审查方案中,例如电子商务审查教程。Next, integrate reviews into an end-to-end moderation scenario, such as the E-commerce moderation tutorial.