# APIs Explorer: Qwik Start - GSP277

## Overview

The [Google APIs Explorer](http://developers.google.com/apis-explorer/) is a tool that lets you explore various Google API methods without writing code. 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 keys](https://developers.google.com/console/help/using-keys) 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.

### Objectives

*   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

### 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 are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials 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 (recommended) or private browser window to run this lab. This prevents 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:** Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that 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 dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
    
    *   The Open Google Cloud console button
        
    *   Time remaining
        
    *   The temporary credentials that you must use for this lab
        
    *   Other information, if needed, to step through this lab
        
2.  Click **Open Google Cloud console** (or right-click and select **Open Link in Incognito Window** if you are running the Chrome browser).
    
    The lab spins up resources, and then opens another tab that shows the Sign in page.
    
    ***Tip:*** Arrange the tabs in separate windows, side-by-side.
    
    **Note:** If you see the **Choose an account** dialog, click **Use Another Account**.
    
3.  If necessary, copy the **Username** below and paste it into the **Sign in** dialog.
    
    ```apache
    student-04-b179b49d2382@qwiklabs.net
    ```
    
    You can also find the Username in the Lab Details pane.
    
4.  Click **Next**.
    
5.  Copy the **Password** below and paste it into the **Welcome** dialog.
    
    ```apache
    rBNYlkXmqcF7
    ```
    
    You can also find the Password in the Lab Details pane.
    
6.  Click **Next**.
    
    **Important:** You must use the credentials the lab provides you. Do not use your Google Cloud account credentials.
    
    **Note:** Using your own Google Cloud account for this lab may incur extra charges.
    
7.  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 Google Cloud console opens in this tab.

**Note:** To access Google Cloud products and services, click the **Navigation menu** or type the service or product name in the **Search** field.

![Navigation menu icon and Search field](https://cdn.qwiklabs.com/9Fk8NYFp3quE9mF%2FilWF6%2FlXY9OUBi3UWtb2Ne4uXNU%3D align="left")

## Task 1. Create a Cloud Storage bucket

1.  In the Cloud console, go to **Cloud Storage** > **Buckets**.
    
2.  Click **Create bucket**.
    
3.  Give your bucket a unique name. Do not include sensitive information in the bucket name - the bucket namespace is global and publicly visible. For example, `qwiklabs-gcp-01-0f18f214c310`\-bucket.
    
4.  Click **Choose how to control access to objects**.
    
5.  Uncheck **Enforce public access prevention on this bucket**.
    
6.  Select **Fine-grained** Access control.
    
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.

**Check my progress**

## 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](https://cdn.qwiklabs.com/3hpf8ZMmvpav2QvPqQCY1Zl1O%2B%2F8rrass6yjAPki3Dc%3D align="left")

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

![Bucket details page in Cloud Storage with UPLOAD FILES text highlighted](https://cdn.qwiklabs.com/ltv7Ocho8kuhhRPBd17pcLSkCKBdVRNgVyCxF7%2BhDig%3D align="left")

### 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).

**Check my progress**

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

1.  Click the three vertical dot object overflow 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*.
    
    *   Select **Public** for the *Entity*.
        
    *   Enter **allUsers** for the *Name*.
        
    *   Select **Reader** for the *Access*.
        
5.  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.

**Check my progress**

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**, search for **Cloud Vision**, then 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.  Open the [Cloud Vision - Try this API](https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate?apix=true) link.
    

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

You will now be on the APIs Explorer page.

**Note:** In the section below the `images.annotate` method from **Cloud Vision API** is being used. You can view all API versions and its method on [Cloud Vision API reference](https://cloud.google.com/vision/docs/reference/rest/).

5.  Click inside of the curly braces in the Request body field.
    
6.  You'll be asked to select a property - choose "**requests**". This will generate the next level.
    
7.  Click inside the brackets and click the blue plus sign icon, select `[Add Item]` - for your property select "**features**".
    
8.  Inside "**features**" click inside the curly brace, click the blue plus icon and select `[Add Item]`, select "**type**"; next to it select **LABEL\_DETECTION**.
    
9.  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**".
    
10.  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:

![The Request body field, which includes the type: LABEL_DETECTION.](https://cdn.qwiklabs.com/WnVacze5IPPxmEFF7%2F9zKsArQMJq1QIXDc8vts9cu4c%3D align="left")

11.  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.

12.  On the right panel of an API Explorer console, you can see Cloud Vision API call with `cURL`, `HTTP` and `JAVASCRIPT`.
     
13.  Now click **Execute**.
     
14.  Select your student account.
     
15.  On the next screen, click **Allow** to give APIs Explorer access.
     

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

![The results of the Cloud Vision API analysis.](https://cdn.qwiklabs.com/%2FJuCQJEhSdEk0LBEs%2BYuXeCD9YYdNIo6nZwQVg3Qow4%3D align="left")

## Task 4. Test your understanding

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

Object names must be unique only within a given bucket.TrueFalse

When an object is shared publicly, any user with knowledge of the object URI can access the object for as long as the object is public.TrueFalse

* * *

## Solution of Lab

<iframe type="youtube" src="https://www.youtube.com/watch?v=1-rAtCeD8W0" data-node-type="hn-embed"></iframe>

```apache
curl -LO raw.githubusercontent.com/ePlus-DEV/storage/refs/heads/main/labs/GSP277/lab.sh
source lab.sh
```

**Script Alternative**

```plaintext
curl -LO https://raw.githubusercontent.com/Itsabhishek7py/GoogleCloudSkillsboost/refs/heads/main/APIs%20Explorer%20Qwik%20Start/abhishek.sh
sudo chmod +x abhishek.sh
./abhishek.sh
```
