Curating, Publishing, and Tracking APIs in Oracle API Manager Cloud Service


Options



Before You Begin

Purpose

This tutorial shows you how to curate, publish and track your application programming interfaces (APIs) in Oracle API Manager Cloud Service.

Time to Complete

1.5 hours

Background

With Oracle API Manager Cloud Service, you can create and publish APIs that expose the functionality of back-end systems or other services:

  • A proxy service that's exposed as an API
  • A user interface to help consumers find and use the APIs
  • Runtime facilities for validating API keys and monitoring API usage

Scenario

In this scenario, you start by creating the Oracle API Manager Cloud Service users and groups:

User Name Group Role
curator API Curator API Curator
consumer API Consumer API Consumer
admin API Admin API Admin

Next, you import an existing service bus project, which will provide the proxy services that you will publish to the Oracle API Manager Cloud Service Portal as an API. The curation process for the API includes adding metadata to help consumers to discover and understand the API and publishing the API to the Oracle API Manager Cloud Service Portal.

You use the API Manager Cloud Service Portal to:

  • Create an application
  • Discover APIs for the application to consume
  • Subscribe applications to APIs

Using the application key supplied by Oracle API Manager Cloud Service, you test the API to ensure that the key works. Finally, you view the captured runtime metrics in Oracle API Manager Cloud Service.

What Do You Need?

Managing Users and Groups

Creating Groups for API Manager Roles

  1. Open Oracle SOA Cloud Service Console, select the service instance that you want to manage, and click Open Fusion Middleware Control Console to start the Oracle Enterprise Manager application.

  2. On the Login page, enter weblogic for the user name and password, and click Login.

    Fusion Middleware Control login page
    Description of this image
  3. In the Target Navigation pane, expand WebLogic Domain, right-click the domain name, select Security, and then select Users and Groups.

    Domain security menu
    Description of this image
  4. On the Users and Groups page, click the Groups tab, and then click Create.

    Groups page
    Description of this image
  5. On the Create a New Group page, enter API Admin in the Name field, enter a description in the Description field, select DefaultAuthenticator from the Provider list, and click Create.

    Create a New Group page
    Description of this image
  6. On the Users and Groups page, repeat steps 4 and 5 to create two more groups:

    • API Consumer
    • API Curator

    After you create the groups, the Groups tab will look similar to the following list:

    Groups list with new groups
    Description of this image

Assigning Application Roles to Groups

  1. In the Target Navigation pane, expand WebLogic Domain, right-click the domain name, select Security, and then select Application Roles.

    Domain security menu
    Description of this image
  2. On the Application Roles page, under the expanded Search section, select Service_Bus_Console from the Application Stripe list, and click Search Application Roles.

    Application Roles page
    Description of this image
  3. On the Application Roles result page, scroll down, select APICurator, and click Edit.

    Application Roles results page
    Description of this image
  4. On the Edit Application Role page for the API Curator role, click Add.

    Edit Application Role:APICurator page
    Description of this image
  5. On the Add Principal page, select Group from the Type list, and click Search roles.

    Add Principal page
    Description of this image
  6. On the Add Principal result page, scroll down, select the API Curator role, and click OK.

    Add Principal results page
    Description of this image
  7. On the Edit Application Role page, verify that the API Curator group is listed as a member, and click OK.

    Edit Application Role page
    Description of this image
  8. On the Application Roles page, verify that the API Curator group contains a membership for the APICurator role.

    Application Role page
    Description of this image
  9. On the Application Roles page, under the expanded Search section, select API_Manager from the Application Stripe list, and click Search Application Roles.

    Application Roles page
    Description of this image
  10. On the Application Roles result page, scroll down, select APIConsumer, and click Edit.

    Application Roles results page
    Description of this image
  11. On the Edit Application Role page for the API Consumer role, click Add.

    Edit Application Role: APICustomer page
    Description of this image
  12. On the Add Principal page, select Group from the Type list, and click Search roles.

    Add Principal page
    Description of this image
  13. On the Add Principal result page, scroll down, select the API Consumer role, and click OK.

    Add Principal results page
    Description of this image
  14. On the Edit Application Role page, verify that the API Consumer group is listed as a member, and click OK.

    Edit Application Role: APIConsumer page
    Description of this image
  15. On the Application Roles result page, scroll down, select APIApplicationAdministrator, and click Edit.

    Application Roles result page
    Description of this image
  16. On the Edit Application Role page for the API Application Administrator role, click Add.

    Edit Application Role: APIApplicationAdministratior page
    Description of this image
  17. On the Add Principal page, select Group from the Type list, and click Search roles.

    Add Principal page
    Description of this image
  18. On the Add Principal result page, scroll down, select the API Admin role, and click OK.

    Add Principal results page
    Description of this image
  19. On the Edit Application Role page, verify that the API Admin group is listed as a member, and click OK.

    Edit Application Role: APIApplicationAdministrator page
    Description of this image

Creating Oracle API Manager Cloud Service Users

  1. In the Target Navigation pane, expand WebLogic Domain, right-click the domain name, select Security, and then select Users and Groups.

    Domain security menu
    Description of this image
  2. On the Users and Groups page, click the Users tab, and then click Create.

    Users and Groups page
    Description of this image
  3. On the Create a New User page, enter curator in the Name field, enter a description, select DefaultAuthenticator from the Provider list, enter and confirm your password, and then click Create.

    Create a New User page
    Description of this image
  4. On the Users and Groups page, repeat steps 2 and 3 to create two more users:

    • consumer
    • admin

    The Users tab will look similar to the following list:

    Users and Groups page with new users
    Description of this image

Assigning Users to Groups

  1. In the Target Navigation pane, expand WebLogic Domain, right-click the domain name, select Security, and then select Users and Groups.

    Domain security menu
    Description of this image
  2. On the Users tab, select the curator user.

    User results page
    Description of this image
  3. On the Settings for User: curator page, click the Groups tab.

    Settings for User: curator page
    Description of this image
  4. Select API Curator and Monitors from the Available list, click the right arrow to move the groups to the Chosen list, and click Save.

    Settings for User: curator, groups tab
    Description of this image
  5. Repeat steps 2, 3 and 4 for consumer and admin users.

    The Settings for User: consumer page will look similar to the following:

    Settings for User: consumer page
    Description of this image

    The Settings for User: admin page will look similar to the following:

    Settings for User: admin page
    Description of this image

Importing Oracle Service Bus Resources

In this section you import the Oracle Service Bus projects from a JAR file, which contains the Currency_Services and Utilities project configurations.

  1. Download the sbconfig.jar file into a local directory on your system. This file contains the Oracle Service Bus sample applications.

  2. Open Oracle SOA Cloud Service Console, select the service instance that you want to manage, and click Service Bus Console to start the Service Bus Console application.

  3. On the Login page, enter weblogic in the User ID field, enter the password, and click Sign In.

    Oracle Service Bus Console login page
    Description of this image
  4. On the Service Bus Console page, click Create to create a session.

    Oracle Service Bus session menu
    Description of this image
  5. On the Resources tab, click the Import Config Jar icon.

    Resources tab with session enabled
    Description of this image
  6. On the Import Config Jar page, click Browse, find the sbconfig.jar file on your file system, and click Next.

    Import Config Jar page
    Description of this image
  7. Verify that the Currency_Services and Utilities projects are selected, and click Import.

    Import Config Jar page with projects displayed
    Description of this image
  8. Verify that the import was completed successfully, and click Close.

    Import Config Jar with result message
    Description of this image
  9. On the Service Bus Console page, click Activate.

    Oracle Service Bus session menu
    Description of this image
  10. On the Confirm Session Activation page, enter a description and click Activate.

    Confirm Session Activation page
    Description of this image

Publishing APIs from the Oracle Service Bus Console

After you've imported the sample project configurations to Oracle Service Bus, you publish the API to Oracle SOA Cloud Service so that consumers can subscribe to it.

  1. Open Oracle SOA Cloud Service Console, select the service instance that you want to manage, and click Open Service Bus Console to start the Oracle Service Bus Console application.

  2. On the Login page, enter curator in the User ID field, enter your password, and click Sign In.

    Oracle Service Bus Console login page
    Description of this image
  3. On the Resources tab, expand the Currency_Services project, and click RestCurrencyRate.

    Resources tab with Currency_Services project files displayed
    Description of this image
  4. On the RestCurrencyRate page, click the API tab.

    RestCurrencyRate page
    Description of this image
  5. Click Edit in the Overview section.

    API tab of the RestCurrencyRate page
    Description of this image
  6. Enter the following values, and click Save:

    • Name: Currency Exchange Rate
    • Version: 1.0
    • Reference Name: API ref
    • Reference URL: http://www.gemservices.com/api/forex/1
    • Tags: cash, money
    API edit enabled
    Description of this image
  7. In the Publish Status section, click Edit, select Published from the Status list, select the Managed check box, and click Save.

    Publish Status section enabled for edition
    Description of this image
  8. On the Service Bus Console page, click Save Changes in All Tabs.

    RestCurrencyRate page
    Description of this image

Adding a Proxy Server to a Business Service

If your instance is behind a proxy, you need to create and add the Proxy Server to your project's business services.

  1. Open Oracle SOA Cloud Service Console, select the service instance that you want to manage, and click Open Service Bus Console to start the Oracle Service Bus Console application.

  2. On the Login page, enter weblogic in the User ID field, enter your password, and click Sign In.

    Oracle Service Bus Console login page
    Description of this image
  3. On the Service Bus Console page, click Create to create a session.

    Oracle Service Bus session menu
    Description of this image
  4. On the Resources tab, expand the System directory and select Proxy Servers.  Click Create and select Create Proxy Server.

    Resources tab with New menu enabled
    Description of this image
  5. On the Create Proxy Server page, enter a resource name and a description, and click Create.

    Create Proxy Server page
    Description of this image
  6. On the Proxy Server Definition page, enter your server host, port number, and login credentials, and click Save.

    OracleProxy page
    Description of this image
  7. On the Resources tab, expand the Currency_Services directory, and select ConvertCurrencyBiz.

    Resources tab with Currency_Services project expanded
    Description of this image
  8. On the ConvertCurrencyBiz page, click the Transport Detail tab, expand Advanced Options, and click Browse next to the Proxy Server field.

    ConvertCurrencyBiz page
    Description of this image
  9. On the Search and Select: Proxy Server Resource page, click Search.

    Search and Select: Proxy Server page
    Description of this image
  10. Select the proxy server that you created, and click OK.

    Search and Select: Proxy Server results page
    Description of this image
  11. On the Service Bus Console page, click Save Changes in All Tabs.

    ConvertCurrencyBiz save menu
    Description of this image
  12. On the Service Bus Console page, click Activate.

    Oracle Service Bus session manu
    Description of this image
  13. On the Confirm Session Activation page, enter a description and click Activate.

    Confirm Session Activation page
    Description of this image

Managing Applications in the Oracle API Manager Cloud Service Portal

After you've imported the Currency Exchange project into the Oracle Service Bus Console in Oracle SOA Cloud Service, you manage the applications in the Oracle API Manager Cloud Service Portal.

  1. Open Oracle SOA Cloud Service Console, select the service instance that you want to manage, and click Open API Manager to start the Oracle API Manager application.

  2. On the Login page, enter consumer in the User ID field, enter your password, and click Sign In.

    Oracle API Manager login page
    Description of this image
  3. On the Oracle API Manager page, click Subscriptions.

    Oracle API Manager home page
    Description of this image
  4. In the APIs section, click New Application.

    Oracle API Manager Subscriptions page
    Description of this image
  5. In the New Application dialog box, enter Currency Exchange in the Name field, enter a meaningful description in the Description field, and click Create.

    New Application page
    Description of this image

    The Currency Exchange application generates a key:

    Currency Exchange application section
    Description of this image

Discovering and Subscribing to APIs in the Oracle API Manager Cloud Service Portal

After you've created your application in the Oracle API Manager Cloud Service Portal, you discover and subscribe to APIs.

  1. Open Oracle SOA Cloud Service Console, select the service instance that you want to manage, and click Open API Manager to start the Oracle API Manager application.

  2. On the Login page, enter consumer in the User ID field, enter your password, and click Sign In.

    Oracle API Manager login page
    Description of this image
  3. On the Oracle API Manager page, click Catalog.

    Oracle API Manager main menu
    Description of this image
  4. On the Currency Exchange Rate 1.0 API page, click Details.

    API Manager Catalog page
    Description of this image

    The details page for the Currency Exchange API displays its statistics and the public URL that's used in the Firefox RESTClient to test the API.

    Currency Exchange Rate Details page
    Description of this image
  5. On the Currency Exchange Rate 1.0 API details page, click Select.

    Currency Exchange Rate page
    Description of this image
  6. In the Selected APIs section, click Subscribe.

    Selected APIs section
    Description of this image
  7. On the application result page, select the Currency Exchange application, and click Select.

    Currency Exchange select page
    Description of this image
  8. In the Subscription result dialog box, click Go to Subscriptions.

    Subscription result page
    Description of this image

    The Currency Exchange application appears in the Applications section with the API subscription.

    Applications page
    Description of this image

Accessing APIs at Runtime

In this section, you use a REST client for Mozilla Firefox.

  1. In the Mozilla Firefox browser, click the RESTClient plug-in to open the client application.

    Mozilla Firefox addons menu
    Description of this image
  2. On the RESTClient page, enter the URL of your Currency Exchange application, add USD/CAD at the end of the URL, and click Send.

    RESTClient page
    Description of this image

    Note: USD/CAD represents the required parameters for the Currency Exchange API. The API URL is taken from the Currency Exchange details page.

  3. On the Response page, verify that the status code is 403 Forbidden.

    Response page with Response Headers tab
    Description of this image

    The 403 Forbidden status code is returned because the API key wasn't included in the request.

  4. On the RESTClient page, click Headers, and select Custom Header.

    RESTClient Headers menu
    Description of this image
  5. In the Request Header dialog box, enter X-API-KEY in the Name field, enter the generated key in the Value field, and click Okay.

    Request Header page
    Description of this image
  6. On the RESTClient page, verify that the API key was added to the Headers pane, and click Send.

    RESTClient page with Headers section
    Description of this image
  7. On the Response page, click the Response Body (Raw) tab, and verify that the conversion rate result was returned.

    Response Body (Row) tab
    Description of this image

Tracking API Usage

After you've tested your API with the RESTClient plug-in, some activity is generated for the Currency Exchange Rate API and the statistics have changed.

  1. Open Oracle SOA Cloud Service Console, select the service instance that you want to manage, and click Open API Manager to start the Oracle API Manager application.

  2. On the Login page, enter admin in the User ID field, enter your password, and click Sign In.

    Oracle API Manager login page
    Description of this image
  3. On the Oracle API Manager page, click Catalog.

    Oracle API Manager menu
    Description of this image
  4. On the Currency Exchange Rate 1.0 application page, click Details.

    API Manager catalog page
    Description of this image
  5. On the Currency Exchange Rate 1.0 API details page, select Since Last Reset from the View Statistics list.

    Application details page with view statistics menu
    Description of this image

    The statistics are displayed. Your metrics may be different, depending on the tests you performed in the RESTClient plug-in.

    API Statistics page
    Description of this image
  6. On the Oracle API Manager page, click Subscriptions to review the existing users' subscription.

    API Manager Subscriptions page
    Description of this image

    Note: The Quick Search section classifies the APIs by their usage.

Want to Learn More?