Moderate with custom image lists in the API console
You use the List Management API in Azure Content Moderator to create custom lists of images. Use the custom lists of images with the Image Moderation API. The image moderation operation evaluates your image. If you create custom lists, the operation also compares it to the images in your custom lists. You can use custom lists to block or allow the image.
Note
There is a maximum limit of 5 image lists with each list to not exceed 10,000 images.
You use the List Management API to do the following tasks:
- Create a list.
- Add images to a list.
- Screen images against the images in a list.
- Delete images from a list.
- Delete a list.
- Edit list information.
- Refresh the index so that changes to the list are included in a new scan.
Use the API console
Before you can test-drive the API in the online console, you need your subscription key. This is located on the Settings tab, in the Ocp-Apim-Subscription-Key box. For more information, see Overview.
Refresh search index
After you make changes to an image list, you must refresh its index for changes to be included in future scans. This step is similar to how a search engine on your desktop (if enabled) or a web search engine continually refreshes its index to include new files or pages.
In the Image List Management API reference, in the left menu, select Image Lists, and then select Refresh Search Index.
The Image Lists - Refresh Search Index page opens.
For Open API testing console, select the region that most closely describes your location.
The Image Lists - Refresh Search Index API console opens.
In the listId box, enter the list ID. Enter your subscription key, and then select Send.
Create an image list
Go to the Image List Management API reference.
The Image Lists - Create page opens.
For Open API testing console, select the region that most closely describes your location.
The Image Lists - Create API console opens.
In the Ocp-Apim-Subscription-Key box, enter your subscription key.
In the Request body box, enter values for Name (for example, MyList) and Description.
Use key-value pair placeholders to assign more descriptive metadata to your list.
{ "Name": "MyExclusionList", "Description": "MyListDescription", "Metadata": { "Category": "Competitors", "Type": "Exclude" } }
Add list metadata as key-value pairs, and not the actual images.
Select Send. Your list is created. Note the ID value that is associated with the new list. You need this ID for other image list management functions.
Next, add images to MyList. In the left menu, select Image, and then select Add Image.
The Image - Add Image page opens.
For Open API testing console, select the region that most closely describes your location.
The Image - Add Image API console opens.
In the listId box, enter the list ID that you generated, and then enter the URL of the image that you want to add. Enter your subscription key, and then select Send.
To verify that the image has been added to the list, in the left menu, select Image, and then select Get All Image Ids.
The Image - Get All Image Ids API console opens.
In the listId box, enter the list ID, and then enter your subscription key. Select Send.
Add a few more images. Now that you have created a custom list of images, try evaluating images by using the custom image list.
Delete images and lists
Deleting an image or a list is straightforward. You can use the API to do the following tasks:
- Delete an image. (Image - Delete)
- Delete all the images in a list without deleting the list. (Image - Delete All Images)
- Delete a list and all of its contents. (Image Lists - Delete)
This example deletes a single image:
In the Image List Management API reference, in the left menu, select Image, and then select Delete.
The Image - Delete page opens.
For Open API testing console, select the region that most closely describes your location.
The Image - Delete API console opens.
In the listId box, enter the ID of the list to delete an image from. This is the number returned in the Image - Get All Image Ids console for MyList. Then, enter the ImageId of the image to delete.
In our example, the list ID is 58953, the value for ContentSource. The image ID is 59021, the value for ContentIds.
Enter your subscription key, and then select Send.
To verify that the image has been deleted, use the Image - Get All Image Ids console.
Change list information
You can edit a list’s name and description, and add metadata items.
In the Image List Management API reference, in the left menu, select Image Lists, and then select Update Details.
The Image Lists - Update Details page opens.
For Open API testing console, select the region that most closely describes your location.
The Image Lists - Update Details API console opens.
In the listId box, enter the list ID, and then enter your subscription key.
In the Request body box, make your edits, and then select the Send button on the page.
Next steps
Use the REST API in your code or start with the Image lists .NET quickstart to integrate with your application.
Feedback
Submit and view feedback for