The Apigee Edge API samples contains the sample API proxies, policies, code, and tools that illustrate the capabilities of Apigee Edge API Services described below.

For instructions on using the samples, see Using the samples.

Doc samples

A set of samples are provided for the API proxy cookbook topics.

Name Description Policy Types Resources
javascript-cookbook Demonstrates a simple JavaScript snippet that adds HTTP headers from variables, transforms an XML-formatted weather report from JSON to XML, and trims content down for mobile clients. Javascript transform.js
javascript-mashup-cookbook A complete JavaScript application that calls to public APIs, combines results, and generates an enriched response for the client app. (Note: this API proxy implements the same functionality as the policy-mashup, demonstrating that the same problem can be addressed using different techniques.) Javascript, StatisticsCollector MashItUp.js
java-cookbook Looks up a weather forecast using Java written to the JavaCallout API. JavaCallout, RaiseFault
policy-mashup-cookbook A complete application that uses policy composition to call two public APIs, combines results, and generates an enriched response for the client app. (Note: this API proxy implements the same functionality as the javascript-mashup, demonstrating that the same problem can be addressed using different techniques.) AssignMessage, ServiceCallout, ExtractVariables, Javascript, RaiseFault, StatisticsCollector GenerateResponse.js
nodejs-baas-cookbook Demonstrates how to create a simple BaaS solution using Node.js on Apigee Edge. The Node.js code orchestrates calls to the API BaaS data store, executes custom logic, and returns appropriate responses. N/A



Sample API proxies

The following API proxies are available in this distribution:

Name Description Policy Types Resources
advanced-api-services This sample contains two API proxies that integrate API services and APIBaaS authentication and authorization. One proxy distributes access tokens and the other validates access tokens. The access token for APIBaaS is embedded int he API services access token, enabling seamless mediation from the API proxy to the API backend on APIBaaS. Note that these proxies are intended to be more functional than instructive. If you are just learning how to build API proxies, skip this one. N/A N/A
apikey Implements simple API key validation VerifyAPIKey, Quota None
async-callout Demonstrates a simple asynchronous callout using the JavaScript httpClient. Javascript assemble_reponse.js, callout.js
base64encoder Demonstrates how to call JavaScript includes from JavaScript resources in API proxies. AssignMessage, Javascript core-min.js, enc-utf16-min.js, enc-base64-min.js, encodeAuthHeader.js
conditional-policy Implements simple conditional policy enforcement. When a request contains an HTTP header responsetime:true, a policy executes a Python script that adds a set of performance metrics to the response message, as HTTP headers Python
dynamic-endpoint Implements simple conditional routing in a slightly more complex scenario, that defines two URLs and one default route. None None
oauth-authcode Demonstrates a fully functional OAuth 2.0 token and authorization endpoint configuration. GenerateAccessToken, GenerateAuthCode, RefreshAccessToken None
oauth-client-credentials Demonstrates a fully functional OAuth 2.0 token endpoint configured for the client credentials grant type. GenerateAccessToken None
oauth-login-app Demonstrates a fully functional OAuth 2.0 token and authorization point configured with a sample login app. GetOAuthV1Info, AssignMessage, GenerateAcceesToken, GenerateAuthorizationCode, RaiseFault None
oauth-verify-accesstoken Demonstrates an API proxy that is configured to validate OAuth 2.0 access tokens and verify Quota. VerifyAccessToken, Quota None
oauth10a-3legged Demonstrates an OAuth 1.0a three-legged configuration. GenerateAceessToken, GenerateRequestToken, GenerateVerifier, VerifyAccessToken, Quota None
outbound-oauth Uses the Microsoft Azure translator API to translate tweets. To do so, it makes an outbound call to obtain an OAuth access token, and then caches the token using the API Services caching policies, reusing the cached token each time an outbound call is made. Also, includes a demonstration browser app used to invoke the API proxy. AssignMessage, LookupCache, PopulateCache, Javascript api-config.js, api-token-get.js, cors.js, timeline-translate.js, translate-query.js, translate-results.js
pagination Paginates an XML response message based on limit and offset parameters provided by the client AssignMessage, ExtractVariables, ResponseCache, XSL paginate.xslt
simple-python Demonstrates a simple scenario of attaching a python script in the
response that adds a header value to it.
soap Demonstrates an XSL transformation that rewrites a WSDL file in response to a request with the query parameter ?wsdl. AssignMessage, ExtractVariables, Script, XSL, fixwsdl.xsl
streaming Demonstrates an HTTP streaming configuration. None None
target-reroute Demonstrates using JavaScript to dynamically select a target URL based on the the content of a request message. ExtractVariables, Javascript setJsHeader.js
twitter-mobile-timeline Demonstrates how to use JavaScript to strip out unneeded parameters from tweets, resulting in a streamlined Twitter timeline that is friendly for resource-constrained mobile devices. Javascript CORS.js, MobileTimeline.js
twitter-oembed Transforms timeline responses (e.g. from statuses/user_timeline.json) into an oEmbed response that contains the timeline data as rich HTML content. JavaScript cors.js, timeline-oembed.js
variables Demonstrates how to extract and set variables based on transport and JSON and XML message content. AssignMessage, ExtractVariables, XMLToJSON None
xmltojson Converts a Yahoo API weather report from XML to JSON. XMLtoJSON None

Reference and Tools


A basic API proxy that helps yuo work through the samples in Using the sample API proxies. The Build APIs section shows you how to build API proxies that run on Apigee Edge, 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,, that imports an API proxy to an organization on Apigee Edge and then deploys it to the environment specified.


Share your experience

Share your experiences on the Apigee Developer Forum.

Help or comments?

  • Something's not working: See Apigee Support
  • Something's wrong with the docs: Click Send Feedback in the lower right.
    (Incorrect? Unclear? Broken link? Typo?)