Open source free API management system

Project address:

This project is the original project address of secondary development based on XXL-API v1.1.1:

Added to the original function:

  1. The interface root address of the independent DEV environment
  2. The guest account is added by default to support guest mode access (only interface tests can be run and mock data can be added), which is used for the business end and customer service personnel
  3. Add API request parameter notes, response result parameter notes, dependent resource properties
  4. Add the record of API modification history, showing the creator and last modification person
  5. Add mock url adaptation, you can directly access the default mock data of the corresponding API (can be specified) through /mock/run/{API URL}, which is convenient for the front-end team to perform uniform configuration of mock tests
  6. Add access support for Apollo configuration center (configuration is optional)
  7. Add support for Atlassian Confluence to automatically generate wiki documents from the API, and adjust the generated format by changing resources/templates/wiki/api.wikitemplate.ftl (configuration is optional)

Function instructions

  • The system for creating a line of business
    API is: line of business/project/group/interface

  • create project

The root address is the host of the API, which is divided into: online, pre-release, test, and development, which can be filled in according to different situations

Later, when testing the interface, the {host}+{apiurl} of the corresponding environment will actually be used to initiate the request

Click to enter the project to manage the interface of the project

  • create group

The interface supports grouping. If not selected, the default grouping will be used. It is recommended to divide the interface according to the "business field" for interface maintenance and management

  • create interface

  • Interface Basic Information

If automatic wiki synchronization is enabled org.s.apiadmin.enableSyncWiki = 1

Accept the specified parent wiki address (the interface wiki will automatically publish as a subpage of this URL) or the wiki address corresponding to the current API (the interface wiki will automatically update the page corresponding to the address)

The wiki address corresponding to the specified API is used in preference to the parent wiki address.

If not filled in, the wiki page will be automatically published to the root directory of the default wiki space, which is the value of the {org.s.apiadmin.wikidefaultspace} configuration item

Another thing to note is to ensure that the wiki user configured by org.s.apiadmin.wikiuser has permission to operate the specified wiki space (add\modify\query)

  • interface test

After adding the interface, you can access the interface test interface through the button on the "Interface Details Page"

Here are 2 points in particular:

  1. If the current interface accepts parameters through the request parameter, the option to use the request body by default should be canceled. If it is the direct body-heavy JSON content, it should be checked
  2. The company's internal interface generally has authentication, so there will be an option to automatically obtain the test token. Checking it means that this request needs to perform authentication. In XxlApiTestController
run(XxlApiTestHistory, HttpServletRequest, HttpServletResponse)

The method of logging in to the access interface is reserved, and this part of the logic needs to be implemented by itself

	 * 实现网关登录调用  公司自己有接口网关需要登录时使用
	 * @param remoteRequest
	 * @param request
	 * @return
	private String remoteCallWtihLogin(HttpRequestBase remoteRequest,HttpServletRequest request,Map<String, Object> queryParamMap) {
		String responseContent = null;
		//TODO 实现接口网关登录逻辑
		responseContent = remoteCall( remoteRequest );
		return responseContent;

  • add mock

Also add mock data through the button of "Interface Details Page"

The first mock data created will be used as the default mock data of the interface, which can be directly accessed through  http://{apiadmin-host}/api-admin/mock/run/{ apiurl}

apiadmin-host is the access host of the current interface management system

In this way, it is convenient for the front-end code to obtain the mock data of the corresponding interface during debugging and unified dynamic configuration.

If there are multiple pieces of mock data, you can set the default value of the interface mock data by clicking the "Set as default" link corresponding to the mock data

To access a specific mock state data, you only need to access the URL opened by clicking "Run".

Guess you like