Skip to main content

Version: 2.13.2304

Publishing APIs to API7 Gateway

Once the API development is completed, it needs to be published to the API7 Gateway to leverage various powerful capabilities offered by API7.

Before the API is deployed and released, thorough testing and configuration debugging should be performed to ensure the stability of the production environment.

info

This article demonstrates the process using a mock API created in Postman based on the Designing APIs.

Prerequisites

  1. Install API7 Enterprise.
  2. Create a workspace.
  3. Designing APIs.

Configuring APIs Manually

Create Upstream

Set the Postman Mock Server as an upstream.

Refer to the documentation on Create an upstream.In 9. Fill in the form, use the following configuration:

Name: shop_server

Targets: Mock Server address

Hostname: Use the domain or IP from Node List

Port: 443

Scheme: HTTPs

Weight: 1

Create Upstream shop server

Create and Publish API

Take CreateProduct as an example.

Refer to the documentation on Create API.In 10: Fill in the form, use the following configuration:

Name: shop_server_CreateProduct

Upstream: Select the shop_server created in the previous step.

Path: /products

HTTP Method: GET

Publish: Enable

Create API - CreateProduct

Importing APIs

You can quickly create multiple APIs by importing the OpenAPI file.

Import OpenAPI

Refer to the documentation on Importing OpenAPI.In 9: Fill in the form, use the following configuration:

Task Name: shop_server

Upload File: shop.yaml

Import API

Configure Upstream

Refer to the documentation on Configuring an Upstream and modify it with the correct target nodes. In 8. Click the corresponding "Configure" button section, select the shop_server upstream that was automatically generated when importing the OpenAPI.

In 9. Edit the properties of the upstream, edit the following properties:

Target: Mock Server address

Port: 443

Hostname: Use the domain or IP from Node List

Scheme: HTTPs

Weight: 1

Configure Upstream

Publish APIs

Refer to the documentation on Publishing an API to change the imported APIs to the published status.

Validate

Access the API through the API7 Gateway address:


curl '${API7_GATEWAY_ADDRESS}/products' \
-H "Host: www.test.com" \
-X POST
--data '{
"name": "iPhone 13 Pro",
"price": 999.99
}'

Get response:


{
"id": 1
}


API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN Ltd. 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation