Apigee API Platform samples are designed to help developers learn how to use the Apigee API Platform. The package contains sample API proxies, policies, code, and tools that illustrate the capabilities of the Apigee API Platform.
Where to get samples
If you have git installed, run:
$ git clone https://github.com/apigee/api-platform-samples
If you do not have git installed, you can browse and download the samples from the API Platform Samples Github Repo.
How to use samples
All of these samples require you to have an account on https://enterprise.apigee.com.
You can sign up for a trial account at https://enterprise.apigee.com/signup.
To use the included deployment tool, you also require Python to be installed on your machine.
After yo download the samples
$ cd /setup
/setup directory, locate the file
In this file, provide settings for your organization, username, and the environment where you want to deploy the API proxies.
After you setup setenv.sh, run:
$ sh deploy_all.sh
This script deploys all API proxies samples to your organization. (The process takes 3-4 minutes.)
Follow prompts to deploy API products, developers, and apps (which are used for OAuth
Once the deploy script completes, navigate to the sample-proxies directory.
In the directory
sample-proxies, you will find one directory per sample proxy. In each directory are two scripts:
- invoke.sh: Run this script to invoke the deployed version of the API proxy
- deploy.sh: Run this script to deploy the API proxy after you make any changes
These scripts are designed to help you iterate quickly, as you make small changes, deploy and invoke to see what effect you change had. This type of iterative development is a great way to investigate the behavior of policies and scripts.
Sample API proxies
The following API proxies are available in this distribution:
||Implements simple API key validation||VerifyAPIKey Quota||None|
||Implements simple conditional policy enforcement. When a request contains an HTTP header
||Implements simple conditional routing. When a request contains an HTTP header
||Implements simple conditional routing in a lsightly more complex scenario, that defines two URLs and one default route.||None||None|
||Demonstrates a fully functional OAuth 2.0 token and authorization endpoint configuration.||GenerateAccessToken, GenerateAuthCode, RefreshAccessToken||None|
||Demonstrates a fully functional OAuth 2.0 token endpoint configured for the client credentials grant type.||GenerateAccessToken||None|
||Demonstrates a fully functional OAuth 2.0 token and authorization point configured with a sample login app.||GetOAuthV1Info, AssignMessage, GenerateAcceesToken, GenerateAuthorizationCode, RaiseFault||None|
||Demonstrates a n API configured to validate OAuth 2.0 access tokens and verify Quota.||VerifyAccessToken, Quota||None|
||Demonstrates an XSL transformation that rewrites a WSDL file in response to a request with the query parameter
||AssignMessage, ExtractVariables, Script, XSL||calculateaddress.py, fixwsdl.xsl|
||Converts a Yahoo API weather report from XML to JSON.||XMLtoJSON||None|
Reference and Tools
A basic API proxy that is used in the API Platform Developer Guide. The Developer Guide shows you how to build API proxies that run on the API platform, with instructions on API Keys, OAuth 1 and 2, developer and app provisioning, custom scripting tutorials, environment configuration, and more.
XML schema files that you can use as a reference when configuring API proxies, policies, API products, and developer and app profiles.
Contains a deployment tool,
Share your experiences on the Apigee Developer Forum.