Trying Out the API

In addition to viewing the SmartDocs API reference documentation, developers can use the Try this API panel to interact with your API without leaving the API documentation. In your portal, developers can send requests to your API and see the responses. Being able to try out your API in your portal will help your users understand what they need to do to get their own code working with your API.

If your API requires an API key or authentication, you must configure your portal so that your users can interact with your Cloud Endpoints API. This page describes the requirements and configuration that you need to do so that developers can use Try this API. For each task, the minimum required Cloud Identity and Access Management permission or role required to complete the task is provided. For more information about Cloud IAM permissions, see the following:

Prerequisites

  • You must have already deployed your API to the App Engine standard environment. The gcloud app deploy command automatically creates a DNS entry on the appspot.com domain for your API so that it is reachable by the Cloud Endpoints Portal.
  • If your API requires an API key:

  • If your API requires authentication:

Configuring API Explorer Settings

If your API requires an API key and/or Firebase or Auth0 authentication, you need to configure these settings before your users can try out your API. This section describes how to configure an API key and authentication settings.

Minimum required permissions: Users granted the Editor role on the API can configure the API Explorer settings. See Granting Access to the API for information on how to assign these roles.

API key

To configure an API key in your portal:

  1. In the GCP Console, go to APIs & Services > Credentials.

    Get an API key

  2. Be sure that the GCP project that the API is in is displayed in the drop-down menu at the top GCP Console window.

    • If you have an existing API key that you want to use:

      1. Click Edit API key edit next to the API key you want to use.
      2. To the right of the API key, click Copy content_copy to copy the API key to the clipboard.
      3. Click Cancel.
    • If you need to create an API key:

      1. Click Create credentials, then select API key.
      2. Copy the key to the clipboard.
      3. Click Close.
  3. Navigate back to your portal.

  4. Click Settings settings.
  5. On the Settings page, click the APIs tab and select your API from the drop-down list.
  6. In the APIs Explorer Settings section, paste the API key into the Google API key field.
  7. Click Save.

Firebase

To configure Firebase:

  1. Open the Firebase Console .

    • If you don't have an existing Firebase project:

      1. Click Add project and select the GCP project name that your API is in.
      2. Click Get Started on the Authentication card.
      3. Click the Sign-In Method tab.
      4. In the Sign-in providers section, enable the providers that you want to use.
      5. In the Authorized domains section, click Add Domain and add your portal domain name (for example, endpointsportal.example-project-12345.cloud.goog).
      6. Click Web Setup. The customized code snippet is displayed.
    • If you have an existing Firebase project:

      1. Go to Develop > Authentication.
      2. Click the Sign-In Method tab.
      3. In the Authorized domains section, click Add Domain and add your portal domain name (for example, endpointsportal.example-project-12345.cloud.goog).
      4. Click Web Setup. The customized code snippet is displayed.
  2. Leave the Firebase Console open because you will need to copy the values of the apiKey and authDomain fields from the code snippet and paste them into the API Explorer Settings fields on the Settings page in the portal for your API.

  3. Open another tab in your browser and navigate to your portal.
  4. Click Settings settings.
  5. On the Settings page, click the APIs tab and select your API from the drop-down list.
  6. In the APIs Explorer Settings section:

    1. Copy the value of the apiKey field from the Firebase code snippet and paste it into the Google API key field.
    2. Copy the value of the authDomain field from the Firebase code snippet and paste it into the Firebase auth domain field.
  7. Click Save.

See the Firebase documentation for more information.

Auth0

Use the following high-level task list to configure Auth0 and your portal:

Task 1. Make sure there is an Auth0 API for the Cloud Endpoints service.

Task 2. Configure Auth0 Application settings.

Task 3. Configure the Auth0 settings in your portal.

Task 1: Make sure there is an Auth0 API for the Cloud Endpoints service

  1. Log on to the Auth0 Dashboard.
  2. Click the APIs menu option on the left navigation bar.
  3. If you see an API with an API Audience in the form of https://SERVICE_NAME, where SERVICE_NAME is the name of your Cloud Endpoints service, then you have already created an API. Continue with the next task to configure the Auth0 Application settings.

    Otherwise, create an API:

    1. Click + Create API.
    2. Enter a name.
    3. In the Identifier field, enter a URL in the format: https://[SERVICE_NAME]

      Replace [SERVICE_NAME] with the name of your Cloud Endpoints service. If you are unsure of the service name, see Getting the Service Name and Configuration ID for details on finding the name of your Cloud Endpoints service.

    4. Click Create.

Task 2: Configure Auth0 Application settings

  1. On the Auth0 Dashboard, click the Applications menu option on the left navigation bar.
  2. Select your Auth0 application or create a new one.
  3. On the Settings tab of your application, scroll down and add your Portal URL (for example, https://endpointsportal.example-project-12345.cloud.goog) to the following fields:

    • Allowed Callback URLs
    • Allowed Web Origins

    These fields accept multiple URLs separated by a comma. Be sure that the URL that you enter does not include a trailing / character.

  4. Click Save Changes.

  5. Keep your Auth0 Settings browser tab open because you will need to copy the values in the Client ID and Domain fields and paste them into the API Explorer Settings fields on the Settings page in the portal for your API.

Task 3: Configure Auth0 settings in your portal

  1. Open another tab in your browser and navigate to your portal.
  2. Click Settings settings.
  3. On the Settings page, click the APIs tab and select your API from the drop-down list.
  4. In the APIs Explorer Settings section:

    1. Copy the value of the Client ID field in the Auth0 Dashboard and paste it into the Auth0 client ID field.
    2. Copy the value of the Domain field in the Auth0 Dashboard and paste it into the Auth0 domain field.
  5. Click Save.

For more information on configuring Auth0, see the Auth0 Dashboard Overview in the Auth0 documentation.

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Endpoints Frameworks for App Engine
Need help? Visit our support page.