Exercise - Test text moderation by using the API testing console


Now that you have a resource available in Azure for content moderation, and you have a subscription key for that resource, let's run some tests by using the API web-based testing console.

  1. Go to the Content Moderator API Reference page. This page is available in many regions for testing in the API console.

  2. For the geographic region closest to you, select the appropriate location button to open the console.

  3. Note the query parameters that you can select for your test. For the first test run, ensure that the classify option is set to false. Leave the remaining values at their default.

  4. Paste your subscription key into the Ocp-Apim-Subscription-Key box.

    Paste subscription key into Ocp-Apim-Subscription-Key box.

  5. Leave the sample text in place, and then select Send.

Evaluate the response

Scroll down the page and evaluate the response from the testing console.

You'll see that the email, IP address, phone, and address values are under a JSON array value of PII. You didn't have to set the PII value to true for this result.

Run more tests

  1. To run the second test, scroll to the top of the page, and set the classify parameter to true.

  2. Select Send.

    There's now a new JSON array section title Classification. It indicates that a review is recommended and displays three categories with score values. The categories are pertaining to the text content that may be undesirable.

    • Category 1 - content could be sexually explicit or adult related
    • Category 2 - language may be considered sexually suggestive or mature in certain situations
    • Category 3 - potentially offensive language
  3. To run more tests, enter some of your own text values from an existing document, and run the tests again to see the results returned.

  4. Study the JSON response and the Request URL syntax to see how your custom applications can call this API.


To test this API by using a C# application, see Quickstart: Analyze text content for objectionable material in C#.

Clean up resources

Remove the resources you created to prevent any unwanted charges to your account.

  1. In the Azure portal, select Resource Groups.

  2. Select the LearnRG resource group, and then select Delete resource group.

  3. Type the resource group name, and then select Delete.