Publish an API Project to API Gateway

When you publish an API from API Creator to API GatewayAPI Server uses the LAC Publish Service service that was created when you installed the API Gateway - Live API Creator Integration solution kit to create a new API Gateway-managed service. This new service represents the published API. API Server adds this new 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 API Creator to API Gateway.


Verify Prerequisites

Ensure that you have completed the following prerequisites:

Publish your API Project

An API is published to API Gateway using one of the following methods:

  • The Live API Creator administrator uses the Admin Command Line Interface (CLI).
  • The Live API Creator developer uses API Creator.
  • The API Gateway administrator uses a cURL command in a command line.

Publish using 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:
    acadmin login -u admin -p Password1 http://localhost:8080 -a MyAPIServer
  2. List and use the API to publish by issuing the following commands:
    lacadmin project list
    lacadmin project use --url_name <API url name>
  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 on to API Creator. If the Welcome Window opens, close it.
  2. On the Home page, go to the CA API Gateway tab.
  3. Complete the following fields and then click Publish:

Gateway Name

Name this API Gateway connection.

API

Select your API from the drop-down.

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 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

  1. In the Policy Manager, click Refresh.
  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 the API from API Creator to API Gateway, configure the published API project. For more information, see Configure Published API Projects in API Gateway.