Skip to main content

Version: 3.2.10.1

Launch Your First API

This tutorial describes how to launch a simple API on API7 Gateway and validate it. You will complete the following steps:

  1. Create a Service, within a Route and an Upstream that points to httpbin.org.
  2. Publish the service to the default Gateway Group.
  3. Use cURL to send an API request to proxy and forward the request to the upstream.

Prerequisites

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

Step 1: 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.

Step 2: 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.

Step 3: 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.

Step 4: 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 IRed Herring

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

Apache Software Foundation