- Audience
- Intro
- Before you begin
- Using the sample proxies
- Setting up
- Deploying a sample proxy
- Invoking a sample proxy
- Modifying a sample proxy
- Bulk deployment
- What else is here?
- Ask questions on the Apigee Community
- Apigee Edge documentation
You are an Apigee Edge API proxy developer, or you would like to learn about developing APIs that run on Apigee Edge. At a minimum, we assume you're familiar with Apigee Edge and how to create simple API proxies. To learn more, we recommend this getting-started tutorial.
This repository contains a collection of sample API proxies that you can deploy and run on Apigee Edge.
The samples provide a jump-start for developers who wish to design and create Apigee Edge API proxies. Each proxy sample includes a deploy.sh
and invoke.sh
script. These scripts let you easily deploy and run the proxies.
In addition, you'll find:
- API proxy schemas that you can reference
- Tools for deploying proxies to Apigee Edge
- Cookbook samples, which illustrate specific use cases
-
If you don't have one, you'll need to obtain an Apigee account. Sign up for a free trial account.
-
You also need to have Python on your system, to use the deployment tool.
-
Download this project from GitHub to your system.
Most developers begin by identifying an interesting sample based on a specific use case or need. You'll find the samples in the ./api-platform-samples/sample-proxies
folder. The Apigee doc site also has a handy samples overview page.
For example, if you're interested in doing XML to JSON transformations, check out api-platform-samples/sample-proxies/xmltojson
.
Set up your deployment environment.
-
Open the file
./api-platform-samples/setup/setenv.sh
in a text editor.| -
Edit the file with your Apigee Edge account settings and save it. For example:
org=myorg username=jdoe@example.com url="https://api.enterprise.apigee.com" env=test api_domain="apigee.net"
We make it easy:
-
Be sure you've updated
./api-platform-samples/setup/setenv.sh
as explained previously. -
cd to one of the sample proxy folders in
./api-platform-samples/sample-proxies
. -
Be sure you can execute the
deploy.sh
script. For example:chmod 744 deploy.sh
-
Execute the deploy script.
./deploy.sh
Note: If you already have the proxy deployed, the script will undeploy it first, then redeploy a new revision.
Output like this means a successful deployment:
Imported new proxy version 3
Undeploying revision 2 in same environment and path:
Environment: test
Revision: 3 BasePath = /
State: error
If 'State: deployed', then your API Proxy is ready to be invoked.
Run 'invoke.sh'
We make this easy too! Each sample API proxy directory contains a script, invoke.sh
, that issues a sample HTTP request to the API. Deploy the proxy and follow these steps:
-
Be sure you've updated
./api-platform-samples/setup/setenv.sh
as explained previously. -
cd to one of the sample proxy folders in
./api-platform-samples/sample-proxies
. -
Be sure you can execute the
invoke.sh
script. For example:chmod 744 invoke.sh
-
Open the
invoke.sh
file and take a look at the code. Basically, the invoke scripts makecurl
requests to Apigee Edge. In some cases,invoke.sh
performs other setup tasks, such as creating products, developer apps, and other entities on Edge.Tip: Always open
invoke.sh
and look through it before executing it -- this will give you valuable insight into how the API proxy is called and any setup steps that are performed. -
Execute the
invoke.sh
script../invoke.sh
Feel free to modify and build upon the sample proxies. You can make changes in the Edge management UI or by editing the proxy XML files locally and redeploying. Whichever approach is comfortable for you.
Tip: If you use Sublime for local development, check out the Sweetlime project on GitHub. Sweetlime is a Sublime plugin for developing API proxies for Apigee Edge.
Simply redeploy the proxies for changes to take effect.
You can deploy all of the samples to your organization at once using a simple setup script provided in this distribution.
-
Update the file
/setup/setenv.sh
with settings for your Apigee account. -
Run
deploy_all.sh
Note: This step deploys all API products, developers, and apps needed for samples that use OAuth.
In addition to the sample proxies, this project includes the following:
The Learn Edge series is a hands-on learning experience for beginning Edge developers. Each example is designed to be quick and easy to do, teaches a core Apigee Edge concept or technique, and follows three basic steps:
- Deploy it.
- Run it.
- Trace it.
The best way to learn Apigee Edge is by doing!
XML schemas that you can use as a reference when working with policies, API proxy configuration, API products, apps, and developers.
Simple scripts to help you deploy the sample API proxies and profiles that they rely on, including API products, developers, and apps.
Set you Apigee API Platform account settings in setenv.sh
(Register for a free Apigee account)
To deploy a single sample, run deploy.sh proxyName
, where proxyName
is the name of the directory under /sample-proxies
that contains the proxy you want to deploy.
To deploy all samples and API products, run deploy_all.sh
-
deploy.py
: Uploads an API proxy to an organization on the Apigee Edge API Services platform and then deploys it to the environment specified. -
proxy_gen.sh
: A simple script that interacts with the API Services platform to locally generate an API proxy scaffold. -
/org-snapshot
: A configurable tool that retrieves organization settings from the API Services platform by using management server API calls.
The Apigee Edge docs are here.
Copyright © 2018 Apigee Corporation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.