API management platform xxl-api

Time:2021-9-19

API management platform xxl-api

1、 Introduction

1.1 general

Xxl-api is a simple and easy-to-use API management platform, which provides API functions such as “management”, “document”, “mock” and “test”. Now open source, out of the box.

1.2 characteristics

  • 1. Extreme simplicity: simple interaction, one minute to start;
  • 2. Item isolation: API splits and isolates items in the dimension of items;
  • 3. Group management: API in a single project supports user-defined group management;
  • 4. Mark Star: API star can be marked and displayed first after marking;
  • 5. API Management: create, update and delete APIs;
  • 6. Perfect API attributes: it supports setting rich API attributes, such as API status, request method, request URL, request header, request parameters, response results, response result format, response result parameters, API comments, etc;
  • 7. Markdown: supports adding markdown format notes to the API;
  • 8. Mock: support to define mock data for API and formulate data response format, so as to quickly provide mock interface and speed up development progress;
  • 9. Online testing: support online testing of API, save test data, and provide interface testing efficiency;

1.3 download

Source code address (the latest code will be released synchronously in the two git warehouses)
Blog address (documents will be updated synchronously in both blogs)
Technical exchange group (only for technical exchange)
  • Group 2: 438249535API management platform xxl-api
  • Group 1: 367260654API management platform xxl-api(group 1 is full, please add group 2)

1.4 environment

  • Servlet/JSP Spec:3.0/2.2
  • JDK:1.7+
  • Tomcat:7+/Jetty8+
  • Mysql:5.6+
  • Maven:3+

2、 Rapid deployment

2.1 initialize the “scheduling database”

Please download the project source code and unzip it to obtain the “initialization SQL script”. The script location is:

/xxl-api/db/xxl-api-mysql.sql

2.2 compiling source code

Unzip the source code, import the source code into the ide in Maven format, and compile it with Maven. The source code structure is shown in the following figure:

API management platform xxl-api

2.3 configuring JDBC connections

Set the JDBC connection of the application in the following project files;

/xxl-api/xxl-api-admin/src/main/resources/xxl-api.properties

2.4 deployment

After the application “XXL API admin” is deployed in a container such as tomcat, you can access the following interface after startup:

API management platform xxl-api

3、 Project management

The API in the system is managed by project, so it is necessary to manage the project first; The project management interface is shown in the figure below;

API management platform xxl-api

3.1 new project

Enter the project management interface and click the “+ new project” button on the right to create a new project, as shown in the following figure:

API management platform xxl-api

Item attribute description:

Project Name: the name of the project;
Project Description: project description information;
Access authority: "public" means that everyone can operate; "Private" permission means that only administrators or project members can operate (in function self-test, it will be pushed);
Follow address - online environment: the follow address of the project's online environment, which is shared by the APIs in the project;
Follow address - pre release environment: the follow address of the project pre release environment;
Tracking address - Test Environment: the tracking address of the project test environment;
Version: the version information of the project;

3.2 update items

Enter the project management interface and click the “Edit” button on the right side of the project to update the project information, as shown in the following figure;

API management platform xxl-api

API management platform xxl-api

3.3 delete item

Enter the project management interface and click the “delete” button on the right side of the project to delete the project information; Note: API cannot be deleted when it exists in the project;

4、 API management

In the project management interface, click the “enter project” button on the right side of the project to enter the interface management interface, as shown in the following figure:

API management platform xxl-api

4.1 API Group Management

  • Add API Group

As shown in the figure below, click the “+” button in the upper right corner of the “left interface grouping area” to add an AIP interface grouping; (click “all” to display the interfaces under all groups in the project; the “default group” is the system group and cannot be deleted.)

API management platform xxl-api

API management platform xxl-api

Interface grouping attribute description:

Group name: the name of the group
Grouping sorting: sorting order of grouping, numeric type. The smaller the value, the higher the value;
  • Update API grouping

In the “interface grouping area on the left”, click the corresponding API grouping, and the API interface list under the grouping will be displayed on the right; As shown in the figure below, click the “edit group” button at the top of the interface list (this function is only available for new API groups) to modify API group information;

API management platform xxl-api

  • Delete API Group

In the “interface grouping area on the left”, click the corresponding API grouping, and the API interface list under the grouping will be displayed on the right; Click the “delete group” button at the top of the interface list (this function is available only for new API groups) to modify API group information;

4.2 API management

  • New API

As shown in the following figure, in the API interface management interface, click the “new interface” button at the top of the interface list to enter the new interface;
In the new interface interface, as shown in the figure below, you can set the API status, request method, request URL, request header, request parameters, response results, response result format, response result parameters, API comments and other information of the interface;

API management platform xxl-api

API management platform xxl-api

API management platform xxl-api

API management platform xxl-api

API attribute description:

Basic information:
    Interface group: the group to which the interface belongs;
    Interface status: the status of the interface. In the interface list, the enabled status interface is marked with a green circle, the maintenance status interface is marked with a yellow circle, and the abandoned status interface is marked with a gray circle;
    Request method: request method, such as post, get, etc;
    Interface URL: the URL address of the interface request. Note that this is a relative address. The following address is obtained from the following address attribute of the item;
    Interface name: the name of the interface;
Request header: multiple request headers can be set on the same interface;
    Header tag: the type of request header, such as accept encoding;
    Header content: request header data, such as the header content UTF-8 of the accept encoding header tag;
Request parameters: multiple request parameters can be set on the same interface;
    Required: this parameter is required;
    Parameter type: the data type of the parameter, such as string;
    Parameter name: the name of the parameter;
    Parameter Description: parameter description;
Response result: set "successful response result" and "failed response result" respectively as the reference of interface response data;
    Response data type (MIME): response result type, such as JSON, XML, etc;
    Response result data: the data of the response result. For example, if the response result type is JSON, the response result data can be set as a piece of JSON data;
Response result parameters: supplementary description of the parameters in the interface "response result". For example, if the response result type is JSON, the parameter information of each field of JSON can be listed here one by one;
    Non empty: whether the parameter can be empty;
    Parameter type: the data type of the parameter, such as string;
    Parameter name: the name of the parameter;
    Parameter Description: parameter description;
Interface remarks: interface remarks in markdown mode;
  • Update API

In the API interface management interface, click the “update interface icon” button on the right side of the interface to enter the update interface interface;

API management platform xxl-api

API management platform xxl-api

  • Delete API

In the API interface management interface, click the “delete interface icon” button on the right side of the interface to delete interface data;

4.3 API-Mock

  • Add mock data

In the API interface management interface, click the interface name to enter the “interface details page”. Click the “+ mock data” button in the upper right corner of the “mock data” module on the interface details page to add mock data;

Mock data attribute description:

Data type (MIME): response result type, such as JSON, XML, etc;
Result data: the data of the response result. If the response result type is JSON, the response result data can be set as a piece of JSON data;

API management platform xxl-api

API management platform xxl-api

API management platform xxl-api

  • Update mock data

In the “mock data” module of the “interface details page”, click the “modify” button on the right side of the mock data list to modify the mock data;

API management platform xxl-api

API management platform xxl-api

  • Delete mock data

In the “mock data” module of the “interface details page”, click the “delete” button on the right side of the mock data list to delete the mock data;

  • Run mock data

In the “mock data” module of the “interface details page”, click the “run” button on the right side of the mock data list to run the mock data;
The system will generate a unique mock connection for each piece of mock data. Accessing the connection will return mock data in the corresponding format according to the set data type such as JSON, as shown in the following figure;

API management platform xxl-api

4.4 API test

  • API test

Enter the “interface details page” and click the “+ interface test” button in the upper right corner of the “test history” module to enter the “interface test interface”,
The interface will automatically initialize the interface URL (the test interface supports the selection of running environment, and the complete URL connection of different environments will be automatically generated) and parameters.
Just fill in the parameter values of the test and click the “run” button below to initiate an interface request, and the request results will be displayed below:

API management platform xxl-api

API management platform xxl-api

  • Save test history

In the “interface test interface”, after the interface test, click the “save” button below to save the test data (interface URL, test parameters and other information).
In the “test history” module of “interface details page”, you can view all interface test history records. Click the “run” button on the right side of a test record to enter the interface test interface corresponding to this test record and restore the test data used in the test at that time;

  • Delete test history

In the “test history” module of “interface details page”, click the “delete” button on the right side of the test history to delete this record;

5、 User management

5.1. New users

Enter the user management interface and click the “+ new user” button in the upper right corner to add user information;

API management platform xxl-api

API management platform xxl-api

User attribute description:

Login account: user's login account;
Login password: the login password of the user;
User type:
    Ordinary users: only public projects or private projects with project permissions are allowed to operate;
    Super administrator: has the operation authority of all items;
Real name: the user's real name;

5.2. Update users

Enter the user management interface and click the “Edit” button on the right side of the user in the user list page to compile user information;

5.3. Delete user

Enter the user management interface and click the “delete” button on the right side of the user in the user list page to delete the user information;

6、 Version update log

Version 6.1 v1.0.0, new features

  • 1. Extreme simplicity: simple interaction, one minute to start;
  • 2. Item isolation: API splits and isolates items in the dimension of items;
  • 3. Group management: API in a single project supports user-defined group management;
  • 4. Mark Star: API star can be marked and displayed first after marking;
  • 5. API Management: create, update and delete APIs;
  • 6. Perfect API attributes: it supports setting rich API attributes, such as API status, request method, request URL, request header, request parameters, response results, response result format, response result parameters, API comments, etc;
  • 7. Markdown: supports adding markdown format notes to the API;
  • 8. Mock: support to define mock data for API and formulate data response format, so as to quickly provide mock interface and speed up development progress;
  • 9. Online testing: support online testing of API, save test data, and provide interface testing efficiency;

Version 6.12 v1.0.1 features (coding)

  • 1. Project permission: it supports setting permissions for projects. Only when you have permissions can you operate the API in the project;

TODO LIST

  • 1. Project permission: it supports setting permissions for projects. Only when you have permissions can you operate the API in the project;
  • 2. API historical version: it supports operations such as comparison and version backtracking of API modification historical versions;

7、 Other

7.1 reporting problems

Xxl-api is hosted on GitHub. If you have any questions, you canISSUESYou can also join the above technical exchange group if you ask questions on the;

7.2 access registration (registration is only for promotion, and the product is open source and free of charge)

More access companies, welcome to GitHubregister


You can sweep it if you support itXXL seriesConstruction of.

API management platform xxl-api