Publish APIs with the API Proxy and Policy Manager

This page describes how to create Gateway-published APIs.
This page describes how to create Gateway-published APIs. Gateway-published APIs use sophisticated policies. You can only add policy templates to Gateway-published APIs using Gateway. The API proxy administrator publishes APIs using the Policy Manager and the API proxy.
In
Layer7 API Developer Portal
, the initial state of newly created Gateway-published APIs is unpublished. The Portal Admin or API Owner then enables the API on
Layer7 API Developer Portal
to make it available to developers. Enabling an API requires assigning the API an API EULA. Developers cannot access the APIs until the API is enabled.
Do not use Gateway-published APIs in a multi-cluster environment where your
Layer7 API Developer Portal
is integrated with multiple API proxies. Use only
Layer7 API Developer Portal
-published APIs in a multi-cluster environment.
If you fail to migrate a Gateway-published API in a multi-cluster environment, the API might appear and then disappear from the APIs section in
Layer7 API Developer Portal
. To resolve this issue, use the Gateway Migration Utility (GMU) to migrate all Gateway-published APIs to all clusters. For more information about the GMU, see "Gateway Migration" in the API Gateway online documentation.
In this article:
2
2
Best Practices for API Proxy Administrators
  • Do not copy and paste Gateway-published APIs (that is, services with the
    Set as Portal Managed Service
    assertion in their policy) in the Policy Manager. The reason is that the original and copy will have the same API ID.
  • To allow the API Explorer to consume APIs that have policies or policy templates containing the Return Template Response to Requestor Assertion, clear the assertion's
    Send Response Immediately
    checkbox.
  • For hybrid customers, if your on-premise Gateway requires a proxy setting for any outbound traffic or connections, modify the Routing Assertions in your specific policies or services.
For
Layer7 API Developer Portal
-published APIs, see Publish APIs with the API Portal.
Create a Gateway-Published API
Follow these steps:
  1. In Policy Manager, log in to the API proxy.
  2. Add an API service to the API proxy.
    For more information about how to add an API service to the API proxy, see the API Gateway online documentation.
  3. Open the API service in the Policy Manager.
  4. Enable the
    Set as Portal Managed Service
    assertion in your API service. You can find this setting in
    Internal Assertions > Set as Portal Managed Service
    .
  5. Use the
    Include Policy Fragment
    assertion to add the
    Portal Service Preface
    fragment to the beginning of the API service.
  6. Drag the
    Set as Portal Managed Service
    fragment to the API service below the
    Portal Service Preface
    fragment.
  7. Select
    Save and Activate
    . After the API proxy and
    Layer7 API Developer Portal
    synchronize, the API appears in
    Layer7 API Developer Portal
    on the APIs page.
  8. Access the Service Properties for the API service. Select the HTTP/FTP tab and then enable the
    Options
    HTTP method.
Enable a Gateway-Published API
Each API listed on the APIs page has one of the following
Layer7 API Developer Portal
states:
Portal State
Icon
Notes
Enabled
enabled.png
The API is published and available.
Unpublished
unpublished.png
Initial state of an API. Requires acceptance of the API EULA.
Disabled
disabled.png
Existing applications will no longer be able to access this API.
Deprecated
deprecated.png
You can deprecate enabled APIs. The API is still available, but use of a replacement API is preferred.
Follow these steps:
  1. Log in to
    Layer7 API Developer Portal
    as a Portal Admin or API Owner.
  2. From the menu bar, select
    Manage
    ,
    APIs
    .
    The APIs page appears.
  3. Filter the list by State, selecting
    Unpublished
    .
  4. Click the name of the API from the filtered list.
    The API Details page for that API appears.
  5. Select
    Actions
    ,
    Edit API Details
    .
    The Details page appears.
  6. Select an
    API EULA
    , and then select
    Save
    .
The Gateway-published API is enabled.
Enable Analytics for a Gateway-Published API
The following policy fragments provide analytics:
  • Standard Policy Template Fragment - API Key
  • Standard Policy Template Fragment - OAuth 2
  • Standard Policy Template Fragment - NoAuth
Follow these steps:
  1. In the Policy Manager, log in to the API proxy.
  2. Open the API Service.
  3. After the Portal Service Preface section, drag the
    Include Policy Fragment
    assertion into the service.
  4. Set context variable for
    apiLocation
    .
    Repeat the same for Set context variable for
    serviceUrl
    .
  5. Select
    one
    of the following fragments, depending on your method of API Protection:
    • Standard Policy Template Fragment - API Key
    • Standard Policy Template Fragment - OAuth 2.0
    • Standard Policy Template Fragment - No Auth
      Gateway_API_Snap.png
  6. Delete
    Route via http to ....
    .
The analytics for the Gateway-published API is enabled.
View Analytics for a Gateway-Published API in API Explorer
Follow these steps:
  1. In API Explorer, right-click the API and open
    Published Service Properties
    .
  2. Under
    HTTP/FTP > Allowed HTTP Methods
    , enable
    OPTIONS
    .
  3. Select
    OK
    .
Test your API and view the Analytics report. You should now be able to view API hits for your Gateway-published API.