Request structure

We are going to make a request as follows:

Field Value
HTTP method POST
URL https://vision.googleapis.com/v1/images:annotate?key=API_KEY
Request body
// SNIPP SNIPP{    "requests": [    {        "image":        {            "content": "/9j/7QBEUGhvdG9zaG9...base64-encoded-image-content...fXNWzvDEeYxxxzj/Coa6Bax//Z"        },        "features": [        {            "type": " SAFE_SEARCH_DETECTION"        }]    }]}// SNIPP SNIPP

Note that the content property under the image property is the base64 encoded version of the image, and under the features, we are requesting the SAFE_SEARCH_DETECTION feature.

Get Google Cloud AI Services Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.