Giter Site home page Giter Site logo

tvprasad / api-platform-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apigee/api-platform-samples

0.0 1.0 0.0 9.33 MB

Working samples for the Apigee API Platform

License: Apache License 2.0

Shell 31.59% Java 1.54% HTML 3.52% CSS 3.94% JavaScript 52.71% Python 4.84% XSLT 1.87%

api-platform-samples's Introduction

Apigee Edge sample API proxies

Audience

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.

Intro

This repository contains a collection of sample API proxies that you can deploy and run on Apigee Edge.

alt text

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

Before you begin

  1. If you don't have one, you'll need to obtain an Apigee account. Sign up for a free trial account.

  2. You also need to have Python on your system, to use the deployment tool.

  3. Download this project from GitHub to your system.

Using the sample proxies

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.

Setting up

Set up your deployment environment.

  1. Open the file ./api-platform-samples/setup/setenv.sh in a text editor.|

  2. Edit the file with your Apigee Edge account settings and save it. For example:

    org=myorg
    [email protected]
    url="https://api.enterprise.apigee.com"
    env=test
    api_domain="apigee.net"
    

Deploying a sample proxy

We make it easy:

  1. Be sure you've updated ./api-platform-samples/setup/setenv.sh as explained previously.

  2. cd to one of the sample proxy folders in ./api-platform-samples/sample-proxies.

  3. Be sure you can execute the deploy.sh script. For example:

    chmod 744 deploy.sh

  4. 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'

Invoking a sample proxy

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:

  1. Be sure you've updated ./api-platform-samples/setup/setenv.sh as explained previously.

  2. cd to one of the sample proxy folders in ./api-platform-samples/sample-proxies.

  3. Be sure you can execute the invoke.sh script. For example:

    chmod 744 invoke.sh

  4. Open the invoke.sh file and take a look at the code. Basically, the invoke scripts make curl 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.

  5. Execute the invoke.sh script.

    ./invoke.sh

Modifying a sample proxy

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.

Bulk deployment

You can deploy all of the samples to your organization at once using a simple setup script provided in this distribution.

  1. Update the file /setup/setenv.sh with settings for your Apigee account.

  2. Run deploy_all.sh

    Note: This step deploys all API products, developers, and apps needed for samples that use OAuth.

What else is here?

In addition to the sample proxies, this project includes the following:

/learn-edge

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:

  1. Deploy it.
  2. Run it.
  3. Trace it.

The best way to learn Apigee Edge is by doing!

/schemas

XML schemas that you can use as a reference when working with policies, API proxy configuration, API products, apps, and developers.

/setup

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

/tools

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

Ask questions on the Apigee Community

alt text

Apigee Edge documentation

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.

api-platform-samples's People

Contributors

akoo1010 avatar anil614sagar avatar baskaran-md avatar carloseberhardt avatar deboraelkin2 avatar dfeuer avatar dinochiesa avatar earth2marsh avatar hansenc avatar harikadas avatar jonesfloyd avatar kbrinner avatar llynch00 avatar michaelarusso avatar mukundha avatar pwwpche avatar rampradeepk avatar rohita-apigee avatar timanglade avatar u2000 avatar wwitman avatar ypomortsev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.