Duration : 20 mins
Persona : API Team
You have a requirement to create a reverse proxy for taking requests from the Internet and forward them to an existing service. You have decided to follow a design first approach & built a reusable component, a specification which can be used to build API Proxies, generate API documentation, generate API test cases using OpenAPI Specification format. You would like to generate an Apigee API Proxy by using the OpenAPI Specification (Swagger) instead of building the API Proxy from scratch.
Apigee Edge enables you to quickly expose backend services as APIs. You do this by creating an API proxy that provides a facade for the backend service that you want to expose. Apigee Edge out of the box supports the OpenAPI specification, allowing you to auto-generate API Proxies. Apigee Edge also has an OpenAPI specification editor & store which you can use to maintain your OpenAPI specifications.
The API proxy decouples your backend service implementation from the API that developers consume. This shields developers from future changes to your backend services. As you update backend services, developers, insulated from those changes, can continue to call the API uninterrupted.
In this lab, we will see how to create a reverse proxy, that routes inbound requests to existing HTTP backend services using a readily available OpenAPI specification.
Go to https://apigee.com/edge and log in. This is the Edge management UI.
Select Develop → Specs in the side navigation menu
Enter the spec details.
Import Name: Employee Backend
Enter the proxy name, base path, and description. This is the first version of our Employees API, so we’ll make it version 1. When you enter the proxy name, the proxy base path will automatically be populated, but you’ll need to change the hyphen before the version to a forward slash.
Proxy Name: employees-v1
Proxy Base Path: /employees/v1
Existing API: Auto-filled from OpenAPI spec
Description: Employees API v1
Note that the base path is the URL you will use to call your API.
Verify the values and click Next.
You can select and de-select list of API Proxy Resources that are pre-filled from the OpenAPI Spec. For example, you might decide that you don’t want to expose the delete operation via the API. In this case, we will expose all the operations, so make sure all 5 are selected and click on Next.
Let us test the newly built API proxy using the Apigee REST Client. Open the REST Client in a new browser window.
Copy the URL for your API proxy.
Let’s save the API Proxy locally as an API Bundle so that we can reuse it in other labs.
Save the API Proxy by downloading the proxy bundle. Return to the Overview tab, and see screenshot below for instructions.
If you like to learn by watching, here is a short video on creating a reverse proxy using an Open API Specification - https://youtu.be/3XBG9QOUPzg
Now that you have created a reverse proxy using an OpenAPI spec, select the Develop tab & explore the flow conditions populated from the OpenAPI spec. Also, explore OpenAPI Spec editor in which you can edit OpenAPI specifications.
That completes this hands-on lesson. In this simple lab you learned how to create a proxy for an existing backend using an OpenAPI Specification and the Apigee proxy wizard.
Useful Apigee documentation links on API Proxies:
Build a simple API Proxy - https://docs.apigee.com/api-platform/fundamentals/build-simple-api-proxy
Best practices for API proxy design and development - https://docs.apigee.com/api-platform/fundamentals/best-practices-api-proxy-design-and-development
Watch this 4minute video on the “Anatomy of an API proxy” - https://youtu.be/O5DJuCXXIRg
Now go to Lab-2