You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs/api-platform/envoy-adapter/v2.0.x/example-hybrid). info

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 sample API proxies](https://docs.apigee.com/api-platform/samples/using-samples).

## Learn by doing

Want to get your hands dirty in a hurry and start building a solid knowledge base about Apigee
Edge? We have a library of "learn-edge" samples in GitHub that let you quickly deploy, invoke,
and trace some sample proxies, starting with the very simplest proxy and moving on to proxies
that illustrate API key validation, quota, response caching, fault handling, and more.

Once you clone the repo and set up your environment (takes just a few minutes), you can try
out each sample in **less than a minute**. And because each sample creates a new
revision of the same proxy, your environment won't get cluttered with a lot of samples. You can
switch revisions, redeploy a different revision in the management UI, and look at the proxy code
any time. The readme for each sample also gives you a brief rundown of what the sample is doing
and how it's set up.

Give it a try! <https://github.com/apigee/api-platform-samples/tree/master/learn-edge>

## Doc cookbook samples

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

| Name | Description | Policy Types | Resources |
|---|---|---|---|
| [javascript-cookbook](https://github.com/apigee/api-platform-samples/tree/master/doc-samples/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](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) [XMLToJSON](https://docs.apigee.com/api-platform/reference/policies/xml-json-policy) | minimize.js setHeaders.js |
| [javascript-mashup-cookbook](https://github.com/apigee/api-platform-samples/tree/master/doc-samples/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](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) | MashItUp.js |
| [java-hello](https://github.com/apigee/api-platform-samples/tree/master/doc-samples/java-hello) | Simple hello world Java callout. | [JavaCallout](https://docs.apigee.com/api-platform/reference/policies/java-callout-policy) | JavaHello.java |
| [java-cookbook](https://github.com/apigee/api-platform-samples/tree/master/doc-samples/java-cookbook) | Converts response content and headers to uppercase. | [JavaCallout](https://docs.apigee.com/api-platform/reference/policies/java-callout-policy) | ResponseUppercase.java |
| [java-properties](https://github.com/apigee/api-platform-samples/tree/master/doc-samples/java-properties) | Demonstrates how to use properties in a Java callout. | [JavaCallout](https://docs.apigee.com/api-platform/reference/policies/java-callout-policy) | JavaProperties.java |
| [java-error](https://docs.apigee.com/api-platform/samples/cookbook/how-handle-java-callout-errors) | Demonstrates error handling patterns that you can use in Java Callout code. | [JavaCallout](https://docs.apigee.com/api-platform/reference/policies/java-callout-policy) | JavaError.java |
| [policy-mashup-cookbook](https://github.com/apigee/api-platform-samples/tree/master/doc-samples/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](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [ServiceCallout](https://docs.apigee.com/api-platform/reference/policies/service-callout-policy) [ExtractVariables](https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy) [Javascript](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) [XMLToJSON](https://docs.apigee.com/api-platform/reference/policies/xml-json-policy) | GenerateResponse.js |

## Sample API proxies

The following API proxies are located in GitHub, where the readme pages provide detailed
descriptions of the samples. If you're interested in how a particular policy works in a sample,
look in the Policy Types column below for the one you're interested in, then click the sample
name in the Name column. (The policies are linked to their respective reference pages in the
docs.)

## Reference and Tools

In addition to the doc cookbook samples and sample proxies in the tables above, the [Edge GitHub samples](https://github.com/apigee/api-platform-samples) also contain these
resources:

| Name | Description | Policy Types | Resources |
|---|---|---|---|
| [r](https://github.com/apigee/api-platform-samples/tree/master/doc-samples/javascript-cookbook)[egex-protection](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/regex-protection) | The regular expression threat protection policy can protect your backend APIs and microservices from SQL injection attacks. | [Regular Expression Protection](https://docs.apigee.com/api-platform/reference/policies/regular-expression-protection) | N/A |
| [oauth-validate-key-secret](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-validate-key-secret) | You are implementing the OAuth Password grant type flow. You need to validate both the application client key and secret on Edge before calling an outside Identity Provider to validate the user's credentials. | [OAuthV2](https://docs.apigee.com/api-platform/reference/policies/oauthv2-policy), others | N/A |
| [condition-pattern-matching](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/condition-pattern-matching) | This proxy lets you easily try out and test conditional statements in an API proxy flow. | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) | N/A |
| [access-entity](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/access-entity) | Shows how to retrieve profiles for entities from the Apigee Edge datastore. | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [AccessEntity](https://docs.apigee.com/api-platform/reference/policies/access-entity-policy) [ExtractVariables](https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy) | none |
| [apikey](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/apikey) | Implements simple API key validation | [VerifyAPIKey](https://docs.apigee.com/api-platform/reference/policies/verify-api-key-policy) [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [Quota](https://docs.apigee.com/api-platform/reference/policies/quota-policy) | none |
| [async-callout](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/async-callout) | Demonstrates a simple asynchronous callout using the JavaScript httpClient. | [Javascript](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) | assemble_response.js callout.js |
| [base64encoder](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/base64encoder) | Demonstrates how to call JavaScript includes from JavaScript resources in API proxies. | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [Javascript](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) | core-min.js enc-utf16-min.js enc-base64-min.js encodeAuthHeader.js |
| [conditional-policy](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/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 | [Script](https://docs.apigee.com/api-platform/reference/policies/python-script-policy) (Python) | timer.py |
| [dynamic-endpoint](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/dynamic-endpoint) | Implements simple conditional routing in a slightly more complex scenario, that defines two URLs and one default route. | none | none |
| [jira-release-notes](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/jira-release-notes) | This is the API proxy used by the Apigee doc team to generate release notes from Jira. | [JSONToXML](https://docs.apigee.com/api-platform/reference/policies/json-xml-policy) [XSL](https://docs.apigee.com/api-platform/reference/policies/xsl-transform-policy) | releasenotes_api.xsl |
| [kerberos-credential-mediation](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/kerberos-credential-mediation) | This sample shows how to perform Kerberos Credential Mediation on Apigee Edge. | [JavaCallout](https://docs.apigee.com/api-platform/reference/policies/java-callout-policy) | Java JAR file |
| [oauth-advanced](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-advanced) | A complete, working example of the authorization code grant type flow, with Apigee Edge as the authorization server. | [GenerateAccessToken](https://docs.apigee.com/api-platform/security/oauth/oauth-home) [GenerateAuthCode](https://docs.apigee.com/api-platform/security/oauth/oauth-home) [RefreshAccessToken](https://docs.apigee.com/api-platform/security/oauth/oauth-home) Many others... | see the example code |
| [oauth-client-credentials](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-client-credentials) | Demonstrates a fully functional OAuth 2.0 token endpoint configured for the client credentials grant type. | [GenerateAccessToken](https://docs.apigee.com/api-platform/security/oauth/oauth-home) | none |
| [oauth-login-app](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-login-app) | Deprecated. We recommend that you look at the [oauth-advanced](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-advanced) sample instead. |   |   |
| [oauth-validate-key-secret](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-validate-key-secret) | Illustrates a technique for validating the client's key and secret before calling an identity provider to validate user credentials in the password grant type flow. | [OAuthV2](https://docs.apigee.com/api-platform/reference/policies/oauthv2-policy) [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [ExtractVariables](https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy) [ServiceCallout](https://docs.apigee.com/api-platform/reference/policies/service-callout-policy) [RaiseFault](https://docs.apigee.com/api-platform/reference/policies/raise-fault-policy) | none |
| [oauth-verify-accesstoken](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-verify-accesstoken) | Demonstrates an API proxy that is configured to validate OAuth 2.0 access tokens and verify Quota. | [VerifyAccessToken](https://docs.apigee.com/api-platform/security/oauth/oauth-home) [Quota](https://docs.apigee.com/api-platform/reference/policies/quota-policy) | none |
| [oauth10a-3legged](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth10a-3legged) | Demonstrates an OAuth 1.0a three-legged configuration. | GenerateAccessToken GenerateRequestToken [ServiceCallout](https://docs.apigee.com/api-platform/reference/policies/service-callout-policy) VerifyAccessToken | none |
| [outbound-oauth](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/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](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [LookupCache](https://docs.apigee.com/api-platform/reference/policies/lookup-cache-policy) [PopulateCache](https://docs.apigee.com/api-platform/reference/policies/populate-cache-policy) [Javascript](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) | api-config.js api-token-get.js translate-query.js translate-results.js |
| [pagination](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/pagination) | Paginates an XML response message based on limit and offset parameters provided by the client | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [ExtractVariables](https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy) [ResponseCache](https://docs.apigee.com/api-platform/reference/policies/response-cache-policy) [VerifyApiKey](https://docs.apigee.com/api-platform/reference/policies/verify-api-key-policy) [XSL](https://docs.apigee.com/api-platform/reference/policies/xsl-transform-policy) | paginate.xslt |
| [response-cache](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/response-cache) | Demonstrates how to cache weather forecasts on Edge for 10 minutes. | [ResponseCache](https://docs.apigee.com/api-platform/reference/policies/response-cache-policy) [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) | none |
| [simple-python](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/simple-python) | Demonstrates a simple scenario of attaching a python script in the response that adds a header value to it. | [Script](https://docs.apigee.com/api-platform/reference/policies/python-script-policy) (Python) | setHeader.py |
| [soap](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/soap) | Demonstrates an XSL transformation that rewrites a WSDL file in response to a request with the query parameter ?wsdl. | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [ExtractVariables](https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy) [Script](https://docs.apigee.com/api-platform/reference/policies/python-script-policy) (Python) [XSL](https://docs.apigee.com/api-platform/reference/policies/xsl-transform-policy) | calculateaddress.py fixwsdl.xsl |
| [streaming](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/streaming) | Demonstrates an HTTP streaming configuration. | none | none |
| [target-reroute](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/target-reroute) | Demonstrates using JavaScript to dynamically select a target URL based on the content of a request message. | [ExtractVariables](https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy) [Javascript](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) | rewriteTargetUrl.js |
| [twitter-mobile-timeline](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/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. | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [Javascript](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) | MobileTimeline.js |
| [twitter-oembed](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/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. | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [JavaScript](https://docs.apigee.com/api-platform/reference/policies/javascript-policy) | search-oembed.js |
| [variables](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/variables) | Demonstrates how to extract and set variables based on transport and JSON and XML message content. | [AssignMessage](https://docs.apigee.com/api-platform/reference/policies/assign-message-policy) [ExtractVariables](https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy) [XMLToJSON](https://docs.apigee.com/api-platform/reference/policies/xml-json-policy) | minimize.js |
| [xmltojson](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/xmltojson) | Converts response data from XML to JSON. | [XMLToJSON](https://docs.apigee.com/api-platform/reference/policies/xml-json-policy) [JSONToXML](https://docs.apigee.com/api-platform/reference/policies/json-xml-policy) | none |
| `/schemas` | XML schema files that you can use as a reference when configuring API proxies, policies, API products, and developer and app profiles. |
| `/tools` | Contains a deployment tool, deploy.py, that imports an API proxy to an organization on Apigee Edge and then deploys it to the environment specified. |
| `/org-snapshot` | The organization snapshot tool retrieves organization settings, including developers, API products, virtual hosts, key/value maps, etc. It can be used to backup the details of an organization, or to discover the settings in an organization. |

## Apigee-127

If you're a coder, [Apigee-127](https://github.com/apigee-127/a127-documentation/wiki) gets you up and coding
API proxies with Node.js and Swagger. You can also find a127 samples on GitHub: <https://github.com/apigee-127/a127-samples>.

## Share your experience

Share your experiences on the [Apigee Developer Forum](https://discuss.google.dev/c/google-cloud/cloud-apigee/104).