arrow_back

APIs Explorer: Qwik Start

Join Sign in

APIs Explorer: Qwik Start

30 minutes 1 Credit

GSP277

Google Cloud selp-paced labs logo

Overview

The Google APIs Explorer is a tool that helps you explore various Google APIs interactively. With the APIs Explorer, you can:

  • Browse quickly through available APIs and versions.
  • See methods available for each API and what parameters they support along with inline documentation.
  • Execute requests for any method and see responses in real time.
  • Make authenticated and authorized API calls.
  • Search across all services, methods, and your recent requests to quickly find what you are looking for.

The APIs Explorer uses its own API key whenever it makes a request. When you use the APIs Explorer to make a request, it displays the request syntax, which includes a placeholder labeled {YOUR_API_KEY}. If you want to make the same request in your application, you need to replace this placeholder with your own API key.

What you'll do

  • Create a Cloud Storage bucket.
  • Upload an image to Cloud Storage and make it public.
  • Make a request to the Vision API with that image.

Setup and Requirements

Qwiklabs setup

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
__Note:__ Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab---remember, once you start, you cannot pause a lab.
__Note:__ If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

How to start your lab and sign in to the Google Cloud Console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is a panel populated with the temporary credentials that you must use for this lab.

    Open Google Console

  2. Copy the username, and then click Open Google Console. The lab spins up resources, and then opens another tab that shows the Sign in page.

    Sign in

    Tip: Open the tabs in separate windows, side-by-side.

  3. In the Sign in page, paste the username that you copied from the left panel. Then copy and paste the password.

    Important: You must use the credentials from the left panel. Do not use your Google Cloud Training credentials. If you have your own Google Cloud account, do not use it for this lab (avoids incurring charges).

  4. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Cloud Console opens in this tab.

Task 1. Create a Cloud Storage bucket

  1. In the Cloud Console, go to the Cloud Storage > Browser.

  2. Click Create bucket.

  3. Give your bucket a unique name. Do not include sensitive information in the bucket name, as the bucket namespace is global and publicly visible.

  4. Click Choose how to control access to objects.

  5. Uncheck the Enforce public access prevention on this bucket box.

  6. Select the Fine-grained circle.

  7. Click Create.

Test Completed Task

Click Check my progress to verify your performed task. If you have successfully created a Cloud Storage bucket, you will see an assessment score.

Create a Cloud Storage bucket.

Task 2. Upload an image

You'll be asking the Cloud Vision API to analyze an image through API Explorer. First, add an image to your bucket for it to analyze. You can use one of your own, or download the image below to your computer and save it as demo-image.jpg .

Dog Image

  1. In your bucket, click Upload Files and select the demo-image.jpg file you saved.

Bucket details page in Cloud Storage with UPLOAD FILES text highlighted

Test Completed Task

Click Check my progress to verify your performed task. If you have successfully uploaded an image in a storage bucket, you will see an assessment score.

Upload an image in a storage bucket (demo-image.jpg).

After the file is uploaded and listed in your bucket, share the image publicly by following these steps:

  1. Click the three vertical dot drop-down menu associated with your image.

  2. Select Edit access from the drop-down menu.

  3. In the overlay that appears, click the + Add entry button.

  4. Add a permission for allUsers.

  5. Select Public for the Entity.

  6. Enter allUsers for the Name.

  7. Select Reader for the Access.

  8. Click Save.

Test Completed Task

Click Check my progress to verify your performed task. If you have successfully made the uploaded image publicly accessible, you will see an assessment score.

Make the uploaded image publicly accessible.

You should see that the image is now public. You're ready to use the API Explorer.

Task 3. Make a request to the Cloud Vision API service

  1. Go to Navigation menu > APIs & Services.

  2. Click + ENABLE APIS AND SERVICES and search Cloud Vision and select the Cloud Vision API from the results list and click on it.

  3. Make sure that API is enabled, if not click Enable.

  4. Now that you have verified the API's enablement, open Cloud Vision - Try this API link.

This will open a new tab with the APIs Explorer page loaded.

You will now be on the APIs Explorer page.

Note: In below section we are using images.annotate method from Cloud Vision API. You can view all API versions and its method on Cloud Vision API link.
  1. Click inside of the curly braces in the Request body field.
  2. You'll be asked to select a property - choose "requests". This will generate the next level.
  3. Click inside the brackets and click the blue plus sign icon, select [Add Item] - for your property select "features".
  4. Inside "features" click inside the curly brace, click the blue plus icon and select [Add Item], select "type"; next to it select LABEL_DETECTION.
  5. You should have the blue plus icon at the end of the "features" block where you can choose to add "image"; then add "source", and "imageUri".
  6. Next to "imageUri" enter the path to the image file in your bucket. The path should look like this: gs://MY_BUCKET/demo-image.jpg When you're done, your Request body field should look like this:

Request body consisting JSON object literal

  1. Make sure that Google OAuth 2.0 and API key checkboxes are selected under Credentials section.
Note: To view Credentials FAQs, click on question mark icon next to Credentials title.
  1. On the right panel of an API Explorer console, you can see Cloud Vision API call with cURL, HTTP and JAVASCRIPT.

  2. Now click Execute.

  3. Select the student account you started the lab with.

  4. On the next screen, click Allow to give APIs Explorer access.

The results of Cloud Vision API analysis the image will be below to your right panel. The top part of the results should look like this:

Success JSON response for Cloud Vision API

Task 4. Test your Understanding

Below are multiple-choice questions to reinforce your understanding of this lab's concepts. Answer them to the best of your abilities.

Congratulations!

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

Exploring APIs quest badge ML Image Processing quest badge

Finish Your Quest

This self-paced lab is part of the Qwiklabs Exploring APIs and Intro to ML: Image Processing Quests. A Quest is a series of related labs that form a learning path. Completing a Quest earns you a badge to recognize your achievement. You can make your badge (or badges) public and link to them in your online resume or social media account. Enroll in a Quest and get immediate completion credit if you've taken this lab. See other available Qwiklabs Quests.

Take Your Next Lab

This lab is part of a series of labs called Qwik Starts. These labs are designed to give you a little taste of the many features available with Google Cloud. Search for "Qwik Starts" in the lab catalog to find the next lab you'd like to take!

Next Steps / Learn More

Google Cloud Training & Certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated February 11, 2022
Lab Last Tested February 11, 2022

Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.