Skip to main content

Version: 3.2.9.5

Launch Your First API

This tutorial describes launching and validating a simple API on API7 Enterprise. You will complete the following steps:

  1. Create a Service with a Route and an Upstream that points to httpbin.org.
  2. Publish the created service to the default Gateway Group.
  3. Validate the created API by sending a request.

Prerequisites

  1. Install API7 Enterprise.
  2. Obtain a user account with Super Admin or API Provider role.
  3. Have at least one Gateway Instance in your default gateway group.

Create a Service

  1. Select Services from the side navigation bar and then click Add Service.
  2. Select Add Manually.
  3. From the Add Service dialog box, do the following:
    • In the Name field, enter httpbin.
    • In the Upstream Scheme field, choose HTTP.
  4. Click Add.

Create a Route

  1. Click the service that you just created in the previous step, and then click Add Route.
  2. From the Add Route dialog box, do the following:
    • In the Name field, enter getting-started-ip.
    • In the Path field, enter /ip.
    • In the Methods field, choose GET.
  3. Click Add.

Publish the Service

  1. Select Services from the side navigation bar and then click Publish Now for the httpbin service.
  2. Choose the default gateway group and then click Next.
  3. From the dialog box, do the following:
    • In the New Version field, enter 1.0.0.
    • In the How to find the upstream field, choose Use Nodes.
  4. From the Add Node dialog box, do the following:
    • In the Host field, enter httpbin.org.
    • In the Port field, enter 80.
    • In the Weight field, use the default value 100.
  5. Click Add.
  6. Confirm the service information, then click Publish.

Use ADC to Create the API

Alternatively, use ADC to configure API7 Enterprise declaratively instead of the dashboard. The complete configuration is below:

adc.yaml
services:
- name: httpbin
upstream:
name: default
scheme: http
nodes:
- host: httpbin.org
port: 80
weight: 100
routes:
- uris:
- /ip
name: getting-started-ip
methods:
- GET

Synchronize the configuration to API7 Enterprise:

adc sync -f adc.yaml

Validate the API

Make an API request to validate the API:

curl "http://127.0.0.1:9080/ip"

You should see the following output:

{
"origin": "127.0.0.1"
}

And that’s it. You have your first API running now.


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 PTE. LTD 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation