How to manage interfaces gracefully? Tencent Ali senior R & D shared the secret for the first time

Time:2022-5-13

**####Where has time gone
**
Agile iteration and teamwork, the working mode of front-end and back-end separation is almost the normal working mode of every Internet company.

The separation of front and back ends has many advantages. One of them is that it only needs to provide a unified API interface, which can be used by multiple clients such as web, IOS and Android, and the efficiency is greatly improved.

However, being born in agile, dying in iteration and being trapped in teamwork are often a major disadvantage of this software development model. With the continuous advancement and change of the project, the project is larger and larger, and the maintenance cost is higher and higher.

Because some companies use wiki, HTML and OpenAPI for interface document management, the version iteration is fast, the interface is often changed, but the update and document maintenance among members often can not keep up.

In terms of API management, there is a considerable and invisible waste of “human resources” in the later stage:

1) The documents are old and unavailable. The newcomers get started and get familiar with the project by word of mouth, resulting in a double waste of manpower, the progress of team members' own work is blocked, and the progress of newcomers competent for the task is slow.
2) The interface is modified due to initial design problems / function expansion / demand change, but it is often difficult to synchronize to the front-end, test and other downstream links in time after modification
3) The interface is not standardized at the initial stage of design, resulting in difficulties in debugging and test understanding of the front-end test, and even some interfaces need to be reworked

These situations will become more serious in the later stage of project development. So that many R & D personnel always complain: not tired of writing code and tired of communication; If you don’t work hard, you have a hard life.
How to manage API gracefully

In order to solve the problem of R & D personnel, we need to solve various pain points in API management. In other words, a perfect API management tool should meet the following characteristics:

**In the interface design stage, it can standardize the interface design of R & D personnel

In the interface debugging stage, provide full debugging of multiple functions and highly simulate the actual working situation

In the process of interface maintenance, the maintenance cost is low, and all changes can be updated to the team colleagues in the downstream work link in time

One stop service, one tool can complete the interface design, debugging, maintenance and testing process without repeated import and export, and each software can be switched back and forth to improve efficiency**

Final solution

The author searched online for a long time and found a solution software that can almost meet the above needs — apifox The main features of this software are:

Visual interface design interface, support HTTPS and HTTPS protocols, follow OpenAPI and JSON schema specifications, and directly fill in all HTTP request parameters and interface description. Support the construction of data model, which can be reused by multiple request parameters.

    It is comparable to the interface debugging function of postman. In addition, it also supports "zero configuration" mock, highly simulated business data and database reading

    The system automatically generates code. According to the definition of interface and data model, the system automatically generates interface request code, front-end business code and back-end business code

    Update the cloud changed data to all team members in real time to avoid repeated work and rework caused by inconsistent data; Code update and document update are all completed in the same software to reduce the maintenance workload

    Project management assigns different execution permissions to different project roles to effectively protect the security of project data; Support the import of old projects in OpenAPI and postman format into apifox, realize the painless migration of projects, and support the export of interface data in HTML format, OpenAPI and other formats.

Next, the author will introduce some functions in detail

interface design

Interface visualization enables editing and management of interface information. Conventional interface request methods such as get and post can be directly selected from the drop-down box; The query, body and header parameters are filled in directly. The return parameters support JSON and XML format import, and format verification can be carried out directly. The interface description part supports text in markdown format.

  1. Interface debugging
    There are two modes of interface debugging: one is quick debugging without creating a project, which directly verifies the interface request and return parameters, and the other is debugging a single interface in the project. The functions of this part are basically equivalent to postman. A variety of front and rear operations can be added:

Verify the return response, and check whether the return status and data structure meet the expectations.

Interface maintenance when changing the interface, directly modify and generate new code in apifox. At the same time, the description documents are stored in the same location. It becomes very convenient to modify the document description easily. After interface changes, collaboration members can synchronize cloud changes in time.

Project management supports data import and export and automatically generates interface code

Set different data permissions for members of different roles. For example, the back-end R & D can modify the interface data, while the front-end and test members only have read-only permission, and the personnel outside the project only have visitor permission. They can only view the interface information and cannot view the data type.

Different servers can be configured for development, debugging, testing, verification and online use:

in addition

Apifox is not only an API management tool for R & D personnel, but also provides a series of functions for testers, such as interface testing, interface automation testing, test management and so on. It can be said to be an artifact for the R & D team to improve efficiency in a one-stop way.
————————————————
Copyright notice: This article is the original article of CSDN blogger “fishindesert”, which follows the CC 4.0 by-sa copyright agreement. Please attach the original source link and this notice for reprint.
Original link:https://blog.csdn.net/yuexias…