Nonexistent node nid: 21.
Was this helpful?

When you add an API to the Apigee API Platform, you configure an API proxy for one or more existing services. Under the hood, the API Platform generates a new API, with its own unique network address and a processing pipeline that handles request and response messages.  The API is exposed over the Internet and can be invoked over HTTP by client apps. 

The API created can be as simple or as detailed as you like. An API can be a simple 'passthrough', exposing a single API method and funneling any type of request to a particular backend service. It can also  be extremely granular, specifying responses based on the HTTP verb of the request, the URI requested, the content of the request or response, and so on. 

Add the Yahoo Weather API

In this tutorial, you will create a proxy for the Yahoo Weather API. The Yahoo Weather API returns XML-formatted weather reports based on an identifier called a WOEID (where on Earth ID). The WOEID for Palo Alto, CA is 12797282. You can call this API directly. In a Web browser, enter:

http://weather.yahooapis.com/forecastrss?w=12797282

The result is an XML-formatted weather report. 

Now you will go through the steps required to send the same request, and receive the same response, via an API proxy on the API Platform.

You must first add the Yahoo Weather API:

  1. Login to https://enterprise.apigee.com. (You can obtain a free account at https://enterprise.apigee.com/accounts/sign_up.) 
  2. In the API Platform UI, select the APIs tab.

  3. Click the add (+) API Proxy button.

  4. In the "Choose Your Starting Point" section of the New API Proxy page, select Existing Backend service and enter http://weather.yahooapis.com as the Backend Service URL.
    The Backend Service URL defines the target URL that the API Platform invokes on behalf of apps. You can add any URL that is accessible over the open Internet.
     
  5. In the "Identify Your API Proxy" section, enter weather for the Display Name and Yahoo weather proxy as the description.
     
  6. Enter /v1/weather as the Project Name.
    The Project Name will be embedded in the proxy URL that apps call to invoke your API. The API Platform uses the proxy URL to match and route incoming request messages to the proper API proxy. The base of the API URL is automatically generated based on your organization and environment.

    Your organization is typically synonymous with the API project name you provided when you signed up for an Apigee account. Although you can join more than one organization, most users will have an account in only one organization. An environment provides a runtime execution context for APIs. By default, Apigee organizations are provisioned with two environments: 'test' and 'prod'.

    For example, if your account is in the organization called apifactory, and your API is configured in the environment test, then the URL that you share with developers would be: http://apifactory-test.apigee.net/v1/weather.

  7. Leave the "Add Features" section as is.

  8. Click Build.
    In response, you should see an acknowledgement that your new API proxy was successfully created. The API platform generates and deploys a set of configuration files that govern the behavior of the processing pipeline for this API proxy as Revision 1. Your new API is automatically deployed into your test environment and listed in the API summary page.
     
  9. Click Close in the acknowledgement to display the details page for the API proxy.

Define API resources

Now you're ready to define your first resource. Defining API resources is completely optional. In steps 4, 5, and 6 you configured everything you need to manage the Yahoo Weather API.

By defining API resources, you gain more granular visibility and control over the API. An API resource is a URI. By defining specific resources, you gain the ability to apply policies to specific URIs, as well as operational visibility into the performance or consumption of those URIs. You can even further refine resource definitions by specifying the HTTP verb used against the URI. In this example, you define a resource that represents a weather forecast, along with the verb GET.

  1. In the Resources section of the weather details page, click the (+) Add Resource button.

  2. Enter forecast for the Name.
  3. Click the Proxy Endpoint menu and choose default.
  4. Click the Verb menu and choose GET.
  5. Enter /forecastrss as the resource Path. By defining this URI, you can monitor and manage it specifically.

  6. Click the check sign in the Action column.

    The resource is added to the API proxy.

Call Yahoo Weather API via the API

Now that you have a proxy for the Yahoo Weather API you can invoke it indirectly, via the API Platform. 

In your Web browser, enter the following, substituting your Apigee organization name for {org_name}.

http://{org-name}-test.apigee.net/v1/weather/forecastrss?w=12797282

Look for the following content in the response: 

<title>Yahoo! Weather - Palo Alto, CA</title> 
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Palo_Alto__CA/*http://weather.yahoo.com/forecast/USCA1093_f.html</link> 
<description>Yahoo! Weather for Palo Alto, CA</description> 
<language>en-us</language>

You have added an API to the Apigee API Platform. You now have the ability modify the characteristics and behavior of the Yahoo Weather API. In the next step you'll add policies to configure your new API. 

Learn more

Nonexistent node nid: 21.

Add new comment

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.