Send Docs Feedback

Create your first API proxy

What you'll learn

In this tutorial, you'll learn to:

  • Create an API proxy.
  • Configure the API proxy to send requests to an existing RESTful target server.
  • Call the API proxy using cURL.

This tutorial walks you through the process of creating and configuring a simple API proxy using the Apigee Edge management UI.

The API proxy you'll create is a "hello world". When you call the API proxy with an HTTP client (we'll use the cURL tool in a terminal window), the API proxy will send the request to an existing target service that returns text in the response.

What you'll need

  • An Apigee Edge account. If you don't have one yet, you can sign up with the directions at Creating an Apigee Edge account.
  • cURL installed on your machine to make API calls from the command line; or a web browser.

Create the API proxy

About the 'mocktarget'

The mocktarget service is hosted at Apigee and returns simple data. It requires no API key or access token. In fact, you can access it in a web browser. Try it out by clicking the following:

http://mocktarget.apigee.net

In the browser and in the test API call you'll make later, the target returns Hello, Guest!. Use the /help resource to get a help page of other API resources that are available.

  1. Go to https://enterprise.apigee.com and log in. This is the Edge management UI.
  2. Click APIs in the top menu.

    Note: In the list of API proxies, you may already have a proxy named helloworld. You can either delete this proxy and continue with the tutorial, or give the proxy in this tutorial a different name.

  3. Click the add (+) API Proxy button.
  4. In the Build a Proxy wizard, select Reverse proxy (most common), and click Next.
  5. Configure the proxy with the following:
    In this field do this
    Proxy Name

    Enter: helloworld

    If a proxy already exists with this name, just enter a different name, such as helloworld_tutorial.

    Project Base Path

    Change to: /v1/hello

    The Project Base Path is part of the URL used to make requests to your API. Apigee Edge uses the URL to match and route incoming requests to the proper API proxy.

    Adding a version number is considered a best practice to version your API. For more information on this important topic, see Versioning Best Practices.

    Existing API

    Enter: http://mocktarget.apigee.net

    Be sure to use http and not https. This defines the target URL that Apigee Edge invokes on a request to the API proxy.

    Description Enter: hello world proxy

  6. Click Next.
  7. On the Security page, select Pass through (none) as the security option, and click Next.
  8. On the Virtual Hosts page, click Next.
  9. On the Build page, make sure the test environment is selected, and click Build and Deploy.
  10. On the Summary page, you see an acknowledgement that your new API proxy was created successfully and deployed to your test environment.
  11. Click View the helloworld proxy in the editor to display the Overview page for the API proxy.

Congratulations! You've created a simple API proxy. Next you'll test it to see how it works.

Test the API proxy

You can test your helloworld API using cURL or a web browser.

In a terminal window, run the following cURL command. Subsitute your organization name in the URL.

You can also enter the URL portion in a web browser to get a similar response.

curl http://<org_name>-test.apigee.net/v1/hello

Response

You should see the following:

Hello, Guest!

Remember that when you created your API proxy, you configured it to send the request to the "Existing API" of http://mocktarget.apigee.net. So at this point, cURLing your new API proxy (http://<org_name>-test.apigee.net/v1/hello) is the same as cURLing http://mocktarget.apigee.net. In later tutorials, you'll see how adding policies to your API proxy changes its behavior.

Way to go! You've built a simple API proxy and tested it.

 

Help or comments?