API request fulfilment

This tutorial describes a use case on how you can use Application Integration to route and fetch information for an ingress API request.

Overview

In this tutorial, you'll create an integration with an API trigger that receives API requests for retrieving customer information. Depending on the API request location, the integration retrieves the customer details from either a MySQL database or an Oracle database.

API Fulfilment diagram API Fulfilment diagram

Objectives

This tutorial shows you how to complete the following tasks in your integration:

  • Add an API trigger.
  • Add and configure Connectors tasks for MySQL and Oracle connections.
  • Add and configure data mapping tasks to extract and map API payload.

Costs

In this tutorial, you use the following billable components of Google Cloud:

The instructions in this tutorial are designed to keep your resource usage within the limits of Google Cloud's Always Free tier.

When you finish the tasks that are described in this document, you can avoid continued billing by deleting the resources that you created. For more information, see Clean up.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Create a service account:

    1. Ensure that you have the Create Service Accounts IAM role (roles/iam.serviceAccountCreator) and the Project IAM Admin role (roles/resourcemanager.projectIamAdmin). Learn how to grant roles.
    2. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    3. Select your project.
    4. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    5. Click Create and continue.
    6. Grant the following roles to the service account: Secret Manager Viewer (roles/secretmanager.viewer), Secret Manager Secret Accessor (roles/secretmanager).

      To grant a role, find the Select a role list, then select the role.

      To grant additional roles, click Add another role and add each additional role.

    7. Click Continue.
    8. Click Done to finish creating the service account.

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Create a service account:

    1. Ensure that you have the Create Service Accounts IAM role (roles/iam.serviceAccountCreator) and the Project IAM Admin role (roles/resourcemanager.projectIamAdmin). Learn how to grant roles.
    2. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    3. Select your project.
    4. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    5. Click Create and continue.
    6. Grant the following roles to the service account: Secret Manager Viewer (roles/secretmanager.viewer), Secret Manager Secret Accessor (roles/secretmanager).

      To grant a role, find the Select a role list, then select the role.

      To grant additional roles, click Add another role and add each additional role.

    7. Click Continue.
    8. Click Done to finish creating the service account.

Prepare your environment

Set up a MySQL database

Connect to your MySQL server and create a database and a table to use in this tutorial. This tutorial uses a database that contains a table named Customers with the following rows:

  +-------------+---------------+--------------------+------------------+
  | customer_id | customer_name | customer_emailID   | customer_city    |
  +-------------+---------------+--------------------+------------------+
  |           1 | Alex          | test-01@test.com   | New York         |
  |           2 | Dana          | test-02@test.com   | Seattle          |
  +-------------+---------------+--------------------+------------------+
  

For information about creating and using a MySQL database, see the MySQL documentation.

Set up an Oracle database

Connect to your Oracle database and create a table to use in this tutorial. This tutorial uses a database that contains a SQL table named Customers with the following rows:

  +-------------+---------------+--------------------+------------------+
  | customer_id | customer_name | customer_emailID   | customer_city    |
  +-------------+---------------+--------------------+------------------+
  |           1 | Amal          | test-01@test.com   | Delhi            |
  |           2 | Hao           | test-02@test.com   | Beijing          |
  +-------------+---------------+--------------------+------------------+
  

For information about creating and using a Oracle database, see the Oracle documentation.

Configure connections

For this tutorial, you must configure the following connections in Integration Connectors:

MySQL connection
Configure a MySQL connection in Integration Connectors to get the Customer tables entities. For information on configuring a MySQL connector, see MySQL connector.
Oracle DB connection
Configure a Oracle DB connection in Integration Connectors to get the Customer tables entities. For information on configuring a MySQL connector, see Oracle DB connector.

Create integration

To create a new integration, perform the following steps:

  1. In the Google Cloud console, go to the Application Integration page.

    Go to Application Integration

  2. Click Integrations from the left navigation menu to open the Integrations page.
  3. Click