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:
- Create a Service, within a Route and an Upstream that points to
httpbin.org
. - Publish the service to the default Gateway Group.
- Use
cURL
to send an API request to proxy and forward the request to the upstream.
Prerequisites
- Install API7 Enterprise.
- Obtain a user account with Super Admin or API Provider role.
- Make sure you have at least one Gateway Instance in your default gateway group.
Step 1: Create a Service
- Select Services from the side navigation bar and then click Add Service.
- Select Add Manually.
- From the Add Service dialog box, do the following:
- In the Name field, enter
httpbin
. - In the Upstream Scheme field, choose
HTTP
.
- In the Name field, enter
- Click Add.
Step 2: Create a Route
- Click the service that you just created in the previous step, and then click Add Route.
- 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
.
- In the Name field, enter
- Click Add.
Step 3: Publish the Service
- Select Services from the side navigation bar and then click Publish Now for the
httpbin
service. - Choose the
default
gateway group and then click Next. - 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
.
- In the New Version field, enter
- 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
.
- In the Host field, enter
- Click Add.
- 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.