Apigee provides a set of samples on GitHub that you can download and run locally.
For more information on creating accounts, see Creating an Apigee Edge account.
To use samples, you should also install Git and Python.
The samples that are located on GitHub. If you do not have Git installed, please refer to GitHub's git setup instructions. If you don't want to install Git, you can browse the files and download a ZIP from https://github.com/apigee/api-platform-samples.
Python is required to run the Apigee deploy tool. Python is present in most Linux environments, on a Mac with XCode installed, on a Windows machine with Cygwin installed, and in many other places.
To obtain Python, please refer to the Python installation instructions.
Use the following procedure to download and deploy the samples:
- To obtain the sample files, run:
$ git clone https://github.com/apigee/api-platform-samples.git
- After you download the samples, go to the
$ cd setup
- In the
/setupdirectory, locate the file
setenv.sh. Edit this file to set your organization, the email address associated with your username, and the environment (prod or test) where you want to deploy the API proxies.
- After you edit
$ sh deploy_all.shThis script deploys all API proxy samples to your organization. (The process takes 3-4 minutes.) Follow prompts to deploy API products, developers, and apps (which are used for OAuth).
- After 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 is a README.md file with information about running the sample, and two scripts that help you as you make small changes to the samples, deploy, and then invoke the sample to see what effect you change had:
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.
- Try the apikey sample. This sample shows how to perform a simple "API key" style of API security using Apigee. Change to the
$ cd sample-proxies/apikey
- Invoke the sample:
$ sh invoke.shYou will be prompted to enter your password. The sample then displays information about the app used to make requests to the API, displays the API key used to access the API, makes a request to the API using the key, and then makes a request using an invalid key.
For more information, see:
- Using the samples for detailed information on running and modifying the samples
- Samples reference for a list of the available samples
- Troubleshooting for help with solving issues with the samples