Was this helpful?

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 CityLookup.java
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

Sample API proxies

The following API proxies are available in this distribution:

Name Description Policy Types Resources
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
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 timer.py
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
simple-python Demonstrates a simple JavaScript snippet that sets HTTP response headers using a predefined variable. Script setHeader.py
soap Demonstrates an XSL transformation that rewrites a WSDL file in response to a request with the query parameter ?wsdl. AssignMessage, ExtractVariables, Script, XSL calculateaddress.py, 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

/simpleProxy

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.

/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.

 

Share your experience

Share your experiences on the Apigee Developer Forum.

コメントを追加

Provide your email address if you wish to be contacted offline about your comment.
We will not display your email address as part of your comment.

We'd love your feedback and perspective! Please be as specific as possible.
Type the characters you see in this picture. (verify using audio)

Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.