This sample lets you create an integrated developer portal for your API product
Apigee's integrated developer portal enables users to quickly and easily stand up a developer portal for their APIs. These portals are fully supported by Google and offer premium capabilities for the majority of developer portal needs. To learn more, see the official documentation.
The Apigee proxy sample uses only a few policies:
- An API Key policy to verify incoming request API Key credentials
- A CORS policy to allow requests from the developer portal webpage
- Provision Apigee X
- Configure external access for API traffic to your Apigee X instance
- Have access to deploy proxies, create products, and provision a portal in Apigee
- Make sure the following tools are available in your terminal's $PATH (Cloud Shell has these preconfigured)
- gcloud SDK
- unzip
- curl
- jq
- npm
Use the following GCP CloudShell tutorial, and follow the instructions in Cloud Shell. Alternatively, follow the instructions below.
- Clone the apigee-samples repo, and switch to the integrated-developer-portal directory
git clone https://github.com/GoogleCloudPlatform/apigee-samples.git
cd apigee-samples/integrated-developer-portal
- Edit the
env.sh
and configure the ENV vars
PROJECT
the project where your Apigee organization is locatedAPIGEE_HOST
the externally reachable hostname of the Apigee environment group that contains APIGEE_ENVAPIGEE_ENV
the Apigee environment where the demo resources should be created
Now source the env.sh
file
source ./env.sh
- Ensure you have an active GCP account selected in the Cloud shell
gcloud auth login
Next, let's deploy some Apigee resources necessary to create an integrated developer portal
./deploy-integrated-developer-portal.sh
NOTE: This script creates an API Proxy and API product. It does not, however, create the developer portal. We will create and test that manually
You've successfully deployed a secured Apigee proxy. Now we need to provision the integrated developer portal:
- Access the portals page from the Apigee homepage. Make sure you are in the correct organization before navigating to Publish > Portals
- Click the +Portal button
- For name you can use "Sample Integrated Developer Portal". You can leave Description blank.
We also need to add our API product to the portal:
- Access your new Sample Integrated Developer Portal
- Enter the API catalog tab, if not already selected
- Click + to add a new API product to the catalog
- Select the sample-integrated-developer-portal-product product and click next
- Configure as shown below
- Published: Select published (checked)
- Display title: Leave default name, sample-integrated-developer-portal-product
- Display description: A portal for an API key protected proxy
- Require developers to specify a callback URL: Keep deselected (unchecked)
- Audience: Anonymous users (anyone can view)
- API product image: Image of your choice (optional)
- API documentation: Use the integrated-developer-portal.yaml OpenAPI document from this repo:
- If you ran the deployment script from Cloud Shell:
- Navigate back to Cloud Shell
- Open integrated-developer-portal.yaml & download it to your local computer. No need to update file content as it was already updated when running the deployment script.
- Otherwise, do the following:
- Download integrated-developer-portal.yaml to your local computer
- Open the file and replace "[APIGEE_HOST]" with your own Apigee host/domain.
- Upload your updated integrated-developer-portal.yaml file as API documentation
- If you ran the deployment script from Cloud Shell:
- Scroll up and click save
Now that we have a developer portal, let's walk through its workflow. First we'll create our developer account and sign in, then we'll make an Apigee app complete with a client id and secret, and finally we'll use the client id to authorize our requests and test our API. To do so, follow the steps below:
- Navigate to your newly created portal. Portals > Sample Integrated Developer Portal
- Enter the portal by clicking the Live Portal button at the top right, or with the following URL: https://[APIGEE-ORG]-sampleintegrateddeveloperportal.apigee.io
- Click the Sign In button and create an account. You need to enter a valid email as the portal necessitate an email confirmation. Note: this creates an Apigee developer account
- Navigate back to your portal's homepage (https://[APIGEE-ORG]-sampleintegrateddeveloperportal.apigee.io) and make sure that you're signed in
- Open the dropdown menu by clicking on your account and select Apps
- Select +NEW APP and update the following fields. Note: this creates an Apigee App for your developer
- App Name: Sample App
- APIs: Enable sample-integrated-developer-portal-product
- Click the SAVE button
- Click into APIs from the top navbar
- Click into your sample-integrated-developer-portal-product
- Select AUTHORIZE and select your app from the dropdown. This authorizes all of your portal requests with your App's API key
- Select the / GET request Path
- Under Try this API, click the EXECUTE button
- You should receive a 200 OK response from Apigee. The body of the response is a copy of the request data you sent to Apigee
To clean up the artifacts created:
First, you need to manually delete some Apigee resources
- Navigate to Publish > Developers
- Find the account you created in your developer portal, hover over it, and select the trash can icon to delete. This will also delete all Apigee Apps associated with your developer
- Navigate to Publish > Portals
- Find your Sample Integrated Developer Portal, hover over it, and select the trash can icon to delete
After that, source your env.sh
script and run the following to delete your product and proxy:
./clean-up-integrated-developer-portal.sh