This article has participated in the good article call order activity, click to see: back end, big front end double track submission, 20,000 yuan prize pool for you to challenge!

With the advancement of development, various documents will come one after another, such as requirement documents, architecture documents, interface documents, etc., which can be easily managed by SVN, Git, etc. In the face of changing requirements, we need to maintain various documents constantly. However, in the development stage, interface documentation is characterized by uncertainty, difficult to maintain and difficult to test, so interface management often becomes a difficult problem.

Today we take the problem of API interface management, let’s take a look at a visual interface management platform YApi, let can easily help us solve the PROBLEM of API management.

YApi introduction

YApi is an efficient, easy-to-use and powerful API management platform, which aims to provide more elegant interface management services for development, product and test personnel. YApi can help developers easily create, publish, and maintain apis. YApi also provides users with excellent interactive experience. Developers only need to use the interface data writing tool provided by the platform and simple click to manage the interface.

Before you start, you can try it out at yapi.baidu.com

features

  • Visual interface management, webSocket-based multi-person collaboration interface editing function and Postman test tool, so that multi-person collaboration exponentially improve the development efficiency.
  • The flat permission design not only ensures the management of large enterprise-level projects, but also ensures the ease of use.
  • Automated testing, perfect interface automated testing, ensure the correctness of data, and support for Response assertion.
  • Mock Server, easy to use Mock Server, convenient to generate Mock data. In addition to supporting normal random mocks, we have added the Mock expectation feature, which returns expected data based on the set request filtering rules.
  • Data import and export, support to import Swagger, Postman, HAR data format, export HTML, Markdown, JSON data format, convenient API interface document migration and archiving.
  • Plug-in mechanism, powerful plug-in mechanism, to meet all kinds of business needs, easy to expand and docking.
  • The structure and documentation of the data returned based on the JSON5 and Mockjs definition interfaces is many times more efficient.
  • Free open source, support secondary development, Intranet deployment, information security and reliability.

Who is in use

  • Where to go
  • ctrip
  • elong
  • Meituan
  • baidu
  • tencent
  • alibaba
  • jingdong
  • Today’s headline
  • Only pay the
  • HOME LINK net
  • Well quickly
  • Convenient bee
  • Zhongshang huimin
  • sina
  • VIPKID
  • Hornet’s nest

Know YApi

Before you start using YApi, let’s familiarize yourself with the YApi website structure, which will give you a quick introduction to YApi.

Login and registration:

To use YApi, you must first register your account.

Home page:

After login, you enter the home page, which displays groups and projects.

At this time, as a new user, you do not have any group or project permissions, so you can only search and browse the “public project” interface. If you cannot find any project on the home page, please contact the administrator to add you to the corresponding project.

  1. The header of the home page displays the current location, search box, create a new item, view a document, and user information.

  2. Group information is displayed on the left of the home page. A group is a collection of items. Only the super administrator can manage groups.

  3. On the right of the home page is the list of items and members under the group. Click a group on the left, and the information of items and members under the group will appear on the right.

  4. Click the star in the upper right corner of the project to follow the project, the project you follow can be viewed in the “my concerns” page.

Project page:

Click a project to enter the project page, which displays all the interfaces of the project and provides all the operations of the project and interface.

At this time, as a new user, you can only browse the interface information, not edit the project or interface, if you need to edit, please contact the administrator to add you to the project.

  1. The Interface List on the left of the item page displays all the interfaces under the item, and the list of all the interfaces under the item is displayed on the right by default.

  2. Click on an interface on the left, and preview, Edit, and Run appear on the right.

  3. Click Test Suite on the left to use the Test suite function.

  4. Click “Settings” in the secondary navigation, the project leader can edit the project information and manage the list of members.

  5. Click “Dynamic” in the secondary navigation to view the operation logs of the project.

Personal center:

Move the mouse to the upper right corner of the user profile picture or user name, you can click “Personal Center” to view personal information.

On the personal information page, you can view and change your user name and password.

YApi operation manual

You can refer to the official tutorial directly.

The deployment of

When you decide to use YApi, you first think about deployment. Although the official provided a detailed deployment document, but the operation down but stepped a lot of pits, but was stump the door. Here, in combination with the official deployment tutorial, I provide one-click offline installation of YApi based on Docker-compose, Kubernetes and other methods, which is more convenient.

Official Deployment Tutorial (Visual deployment recommended)

You can directly refer to the official tutorial. In addition to the deployment itself, this tutorial allows us to further understand some details of YApi, such as: what to rely on, what to configure, etc., which also provides a reference for my next Docker deployment.

Docker Online/Offline Deployment (personal recommendation)

The visual deployment (YAPi-CLI tool) is very simple when there is a network, but it does not work on the Intranet (no Internet). Therefore, a customized Docker image can be used for one-click deployment of YApi by means of Docker-compose or Kubernetes.

mirror

This part mainly describes the making process of the image. Docker image has been pushed todocker hub, directly pull, no need to make their own mirror.

Config. json: YApi configuration file, which can be modified as required and typed into the image.

Commons. Js: Resolve the YApi bug.

  1. Clone the project code locally

    git clone https://github.com/xcbeyond/deploy-scripts.git
    Copy the code
  2. Build the mirror

    Docker build -t xcbeyond/yapi:1.9.2Copy the code
  3. Push the mirror

    Docker push xcbeyond/yapi: 1.9.2Copy the code

A key deployment

One-click deployment via Docker-compose and Kubernetes is supported.

The docker image tar package was obtained. Procedure

If an external network is available, you can skip this operation.

If you are offline (no external network), prepare the Tar docker image package in advance.

  1. In the Docker environment that can normally connect to the Internet, pull the image XCBeyond/yAPI.

    Docker pull xcbeyond/yapi: 1.9.2Copy the code
  2. The docker image tar package is generated.

    Docker save-o yapi-1.9.2.tar xcbeyond/yapi:1.9.2Copy the code
  3. Upload the tar image package yapi-1.9.2.tar to the environment to be deployed.

  4. Import the tar image package.

    Docker load < yapi - 1.9.2. TarCopy the code
Docker – compose deployment

Upload the docker-compose file /yaip/docker-compose. Yaml to the deployment environment and run the docker-compose command docker-compose up -d to complete the deployment.

The browser address is http://< Deployment environment IP address >:3000. You can log in as the super administrator or register a new account.

Super administrator: [email protected], ymfe.org. You are advised to change the password after login.

Kubernetes deployment

Upload the Kubernetes deployment resource file to the deployment environment and run the kubectl apply -f command to execute the mongodb. Yaml and yapi.yaml files respectively.

Kubectl apply -f mongodb. Yaml # Wait until mongodb is successfully started and then execute yapi kubectl apply -f yapiCopy the code

Note: Start mongodb first, then yAPI.

The browser address is http://< Deployment Environment IP address >:30300. You can log in as the super administrator or register a new account.

Super administrator: [email protected], ymfe.org. You are advised to change the password after login.

References:

  1. hellosean1025.github.io/yapi/

  2. Github.com/xcbeyond/de…