Publish an API to API Gateway

Publish an API from 
Layer7 Live API Creator
 to API Gateway.
lac53
When you publish an API from 
Layer7 Live API Creator
 to 
Layer7 API Gateway
, API Server creates a new API Gateway-managed service using the 
LAC Publish Service
 service that was created when you installed the integration solution kit. This service represents the published API. API Server adds this service to the 
LiveAPICreator/LAC Projects
 folder in API Gateway. The name of the service is the name of the API.
Complete the following process for every API you want to publish from 
Layer7 Live API Creator
 to API Gateway.
In this article:
2
Verify the Prerequisites
Ensure that you have completed the following prerequisites:
  • You have enabled access to OpenAPI (Swagger) API documentation without authentication.
    For more information about how to enable access to Swagger documentation without authentication, see API Properties.
  • (For publishing using cURL commands) You have obtained the Swagger documentation URL of the API that you published to API Gateway and have downloaded the returned JSON response as a JSON file, for example, 
    demo.json
    . For example:
    https://liveapicreator.mycompany.com:8080/rest/default/demo/v1/@docs?auth=demo_full:1
  • (For publishing using the 
    Layer7 Live API Creator
     Admin command-line interface (Admin CLI)) You have installed the Admin command-line interface (CLI).
    For more information about how to install the Admin CLI, see Live API Creator Admin CLI npm site.
Publish your API
Publish your API from 
Layer7 Live API Creator
 to API Gateway using one of the following methods:
Publish using the Admin CLI
  1. Log in to the API Server as an administrator using the Admin CLI by issuing the following command:
    lacadmin login -u <admin user name> -p <password> <URL for the API Server (Jetty or Tomcat)> -a <alias for the API Server>
    For example:
    lacadmin login -u admin -p Password1 http://localhost:8080 -a MyAPIServer
  2. List and use the API to publish by issuing the following commands:
  3. Publish the API's Swagger doc to your API Gateway:
    lacadmin gateway publish --username <API Gateway admin user name> --password <API Gateway admin password> --hostname <protocol>://<API Gateway host name>:<API Gateway port>/lacman/1.0/publish --url_name <urlfragment> --apiversion <version
    For example:
    lacadmin gateway publish --username admin --password Password1 --hostname https://gateway1:8443/lacman/1.0/publish --url_name demo --apiversion v1
  4. Confirm that your API has successfully published with API Gateway response 'OK'.
API Server creates a new API Gateway-managed service in API Gateway and adds this new service to the 
LiveAPICreator/LAC Projects
 folder in API Gateway.
Publish using API Creator
You can publish the API's Swagger 2.0 documentation from API Creator to the configured Gateway.
  1. Log in to API Creator.
    For more information about how to log in to API Creator, see Managing APIs.
  2. On the APIs page, click the 
    CA API Gateways
     tab.
  3. Above the list API Gateways, click 
    Add
    .
  4. Complete the following fields, and then click 
    Publish
    :
    CA API Gateway Name
    The name for this API Gateway connection.
    URL
    Enter 
    <protocol>://<API Gateway host name>:<API Gateway port>/lacman/1.0/publish
    .
     
    Example:
     
    https://gateway1:8443/lacman/1.0/publish
    .
    API Version
    Select your API version or accept the default.
    Username
    Enter the Gateway Admin user name.
    Example:
     
    admin
     
    Password
    Enter the Gateway admin password.
    Example:
     
    Password1
    .
A record of this API Gateway connection is added to the list of API Gateways in API Creator and the API is published to API Gateway. API Server creates a new API Gateway-managed service in API Gateway and adds this new service to the 
LiveAPICreator/LAC Projects
 folder in API Gateway.
Publish using a cURL Command
  1. Issue the following command:
    curl -kis -H "Content-Type: application/json" -X PUT -d @<your downloaded file> -u <API Gateway admin user name>:<API Gateway admin user password> <protocol>://<API Gateway host name>:<API Gateway port>/lacman/1.0/publish
     
    For example:
     
    curl -kis -H "Content-Type: application/json" -X PUT -d @demo.json -u admin:7layer https://gateway1:8443/lacman/1.0/publish
  2. Confirm that your API project is successfully published with status code 200.
API Server creates a new API Gateway-managed service in API Gateway and adds this new service to the 
LiveAPICreator/LAC Projects
 folder in API Gateway.
Confirm that the API Gateway-Managed Service is Created
You confirm that the API Gateway-managed service is created using Policy Manager. The Services and Policies list in the lower left corner of the Policy Manager lists all published services under a single root folder bearing the hostname.
For more information about how to view a list of the published services, see the Layer7 API Gateway documentation.
  1. In the Policy Manager, click 
    Refresh
    .
    The list of services is refreshed.
  2. Expand the 
    LiveAPICreator/LAC Projects
     folder and confirm that API Server has added the new API Gateway-managed service to the folder.
Next Steps
Now that you have published your API from API Creator to API Gateway, configure the published API.
For more information about how to configure your published API, see Configure Published API Projects in API Gateway.