Updated on 2024-01-19 GMT+08:00

Getting Started

Introduction

This section describes how to call an API to create an HTTP API.

For details about how to call APIs, see Calling APIs.

Procedure

  1. Call the API mentioned in Creating an API Group to create an API group.
  2. Call the API mentioned in Creating an API to create an HTTP API.

Creating an HTTP API

  1. Call the API mentioned in Creating an API Group to create an API group.

    {
    	"name": "APIGroup_test",
    	"remark": "Test group"
    }

    Specify the following parameters:

    • name: API group name
    • remark: Description of the API group

  2. Call the API mentioned in Creating an API to create an HTTP API.

    {
    	"auth_type": "APP",
    	"backend_api": {
    		"req_method": "GET",
    		"req_protocol": "HTTP",
    		"req_uri": "/test/benchmark",
    		"timeout": 1000,
    		"url_domain": "xx.xx.xx.93:12346"
    	},
    	"backend_type": "HTTP",
    	"group_id": "2b89e73458******98a828c5eca3b6c3",
    	"name": "test",
    	"req_method": "GET",
    	"req_uri": "/test",
    	"type": 1,
    	"result_normal_sample": "hello world!"
    }

    Specify the following parameters:

    • auth_type: Security authentication mode of the API
    • backend_api: Backend service parameters
      • req_method: API request method
      • req_protocol: Request protocol of the backend service
      • req_uri: Request path of the backend service
      • timeout: Timeout interval allowed for APIG to request the backend service
      • url_domain: Address of the backend service

        The following reserved IP address segments cannot be used:

        • 0.0.0.0/8
        • 10.0.0.0/8
        • 100.125.0.0/16
        • 127.0.0.0/8
        • 169.254.0.0/16
        • 172.16.0.0/12
        • 192.0.0.0/24
        • 192.0.2.0/24
        • 192.88.99.0/24
        • 192.168.0.0/16
        • 198.18.0.0/15
        • 198.51.100.0/24
        • 203.0.113.0/24
        • 224.0.0.0/4
        • 240.0.0.0/4
        • 255.255.255.255/32
    • backend_type: Type of the backend service
    • group_id: ID of the group to which the API belongs. Obtain the group ID by following the instructions in Querying the API Group List.
    • name: Name of the API
    • req_method: Request method of the API
    • req_uri: Access address of the API
    • type: Type of the API. 1 means public API and 2 means private API.
    • result_normal_sample: Example response for a successful request

    After creating the API, view it on the APIG console.