Using API Explorer

This quickstart steps you through the process of:

  • Creating a Cloud Storage bucket.
  • Uploading your image to Cloud Storage and making it public.
  • Making a request to the Vision API with that image.

These steps should take about 5 minutes to complete. You can store up to 5GB of data in Cloud Storage for free and make up to 1000 feature requests to the Vision API for free per month.

Before you begin

If you haven't done so already, set up your project and create a Google Cloud Storage bucket, as explained below.

Set up your project

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the GCP Console, on the project selector page, select or create a GCP project.

    Go to the Project selector page

  3. Verifica che la fatturazione sia attivata per il tuo progetto.

    scopri come attivare la fatturazione

  4. Enable the Cloud Vision API.

    Enable the API

Create a Cloud Storage bucket

  1. In the GCP Console, go to the Cloud Storage Browser page.

    Go to the Cloud Storage Browser page

  2. Click Create bucket.
  3. In the Create bucket dialog, specify the following attributes:
    • Name: A unique bucket name. Do not include sensitive information in the bucket name, as the bucket namespace is global and publicly visible.
    • Storage class: Multi-Regional
    • A location where bucket data will be stored.
  4. Click Create.

Make a request to the Cloud Vision API service

  1. Download demo-img.jpg. (You may need to right-click the link.)

  2. Open the GCP Console Storage Browser.

  3. Select the bucket you created in the previous section.

  4. Click Upload Files and select the demo-img.jpg file to upload from your local machine to your Cloud Storage bucket.

    This is the image file that you just uploaded:
    women biking in Jakarta image
    Image credit: Rohiim Ariful, Unsplash.

  5. After the file is uploaded and listed in the Cloud Storage Browser, share the image publicly.

  6. Complete the interactive API Explorer template, below, by replacing cloud-samples-data/vision in the image.source.imageUri field with the name of the Cloud Storage bucket where you uploaded the demo-img.jpg file.

  7. Click Execute to send the request to the service. The JSON response appears above.

Congratulations! You've made your first images.annotate request to the Cloud Vision API service.

Clean up

To avoid unnecessary Google Cloud Platform charges, use the GCP Console to delete your Cloud Storage bucket (and your project) if you do not need them.

What's next

Hai trovato utile questa pagina? Facci sapere cosa ne pensi:

Invia feedback per...

Cloud Vision API Documentation
Hai bisogno di assistenza? Visita la nostra pagina di assistenza.