当前位置:网站首页>Powerful domestic API management tool
Powerful domestic API management tool
2022-07-06 22:00:00 【Peach blossom key God】
Preface
If you are a Java Back end Development Engineer , image Swagger、Postman、RAP These tools , It should be familiar ! It brings a lot of convenience to our interface development , But because these are independent frameworks , There is no interoperability between , Therefore, when coordinating among multiple frameworks , Inevitably, it will bring some repetitive work ;
Today, let's introduce a powerful domestic tool :Apifox, take Swagger 、 Postman 、 RAP 、 JMeter The function of is perfectly integrated , A tool , Fix it all .
What is? Apifox
Apifox = Interface debugging + Interface documents are generated quickly + Standardized management of interface documents +Mock API+ Interface process test .
Common interface management schemes :
API file :Swagger
debugging API:Postman
Mock API data :RAP
API automated testing :JMeter
Apifox The original intention is to improve the efficiency of various roles of the R & D team ! The audience of the product is the front-end development 、 The whole R & D technical team composed of back-end development and testing personnel and technical managers .
Apifox Integrate each role of the R & D team through the collaboration function .
function
- Interface design : Apifox Interface documentation follows OpenApi 3.0 ( primary Swagger)、JSON Schema At the same time , Provides a very easy to use visual document management function , Zero learning cost , Very efficient . And support online sharing of interface documents .
- Data model : Reusable data structure , Define the interface return data structure and request parameter data structure ( only JSON and XML
Pattern ) You can directly reference . Support model direct nested reference , direct JSON/XML Smart import , Support oneOf、allOf And other advanced combination modes . - Interface debugging : Postman Some functions , For example, environment variables 、 In front of / Post script 、Cookie/Session Global Shared And so on ,Apifox There are , And ratio Postman More efficient and easy to use . After the interface runs, click the save as use case button , Interface use cases can be generated , Interface use cases can be run directly later , No more parameters need to be entered , Very convenient . Custom script 100% compatible Postman grammar , And support running javascript、java、python、php、js、BeanShell、go、shell、ruby、lua And other language codes .
- Interface use cases : Usually, an interface has multiple use cases , For example, the parameters are correct, and the use case 、 Parameter error use case 、 Data is empty use case 、 Different data state use cases, etc . The correctness of data will be automatically verified when running the interface case , Using interface use cases to debug interfaces is very efficient .
- Interface data Mock: built-in Mock.js Rules engine , Very convenient mock All kinds of data , And you can define the data structure and write mock The rules . Support adding “ expect ”, According to the request parameters, different mock data . most important of all Apifox Zero configuration that will do Mock Very human data , The details are introduced later in this paper .
- Database operation : Support reading database data , Used as an interface request parameter . Support reading database data , Used to verify ( Assertion ) Whether the interface request is successful .
- Interface automation testing : Provide interface set testing , You can choose the interface ( Or interface use cases ) Quickly create test sets . At present, more functions of interface automation test are still under development , Coming soon ! The goal is :JMeter Some functions are basically , And use it better .
- Quick debugging : similar Postman Interface debugging mode , The main purpose is to temporarily debug some interfaces that do not need to be documented , You can quickly debug without defining the interface in advance .
- Code generation : Define according to the interface and data model , The system automatically generates the interface request code 、 Front end business code and back-end business code .
- Teamwork : Apifox Born for teamwork , Interface cloud real-time synchronous update , A mature team / project / Member rights management , Meet the needs of various enterprises .
Use
API Interface to use
send out HTTP request
API Interface function layout

API Request parameters
Header and cookie Parameters
You can set or import Header Parameters ,cookie You can also set 
Query Parameters
Query Support construction URL Parameters , Support at the same time RESTful Of PATH Parameters ( Such as :id)
Body Parameters
Body There are three types form-data / x-www-form-urlencoded / raw , Each type offers three different UI Interface
- When you need to submit a form , Switch to x-www-form-urlencoded

- When you need to submit a form with documents , Switch to form-data

- When you need to send JSON Object or other objects , Switch to the corresponding raw The type is enough

API Request and response
Click the send button , If there is data returned , The returned data... Will be displayed , response time , Response code ,Cookie etc. .
Be careful : The default returned data is Pretty Pattern , Easy to view JSON XML Format . You can switch Native or preview Pattern See other types .
return Headers

Set global parameters
Here's a reminder , I also found out the setting of this global parameter after looking for a long time . It's a little deep , The main reason is that there are too many functions, haha .

Here you can also set up a test environment 、 Global environment 、 Global variables 、 Local mock、 Cloud mock etc. , It has complete functions and is very powerful .
One click document generation
Generating documentation
New interface 
Set interface information 

Set direct save 
Integration of interface documents
Modifying the interface here directly modifies the document , It is very convenient . The modified document and interface can be updated synchronously in real time to call the open system API All developers , It avoids a lot of communication and notification work required for project interface upgrading or iteration .
Document export

Import postman\swagger file
Import documents can be added in the interface management office 
Support import OpenApi (Swagger)、Postman、apiDoc、HAR、RAML、RAP2、YApi、Eolinker、NEI、DOClever、ApiPost 、Apizza 、ShowDoc、API Blueprint、I/O Docs、WADL、Google Discovery And so on , Facilitate the migration of old projects .
Support timed automatic import OpenApi (Swagger)、apiDoc、Apifox Format data .
Share documents online
You can share your interface with other members , You can also set our access password 、 Expiration time, etc. click on the Project Overview =》 New share 

Mock
Most enterprises adopt agile development for their products , In order to ensure multi terminal synchronization , Once the plan is determined , It needs to pass Mock Generate API Data rules for ; In this way, multiple terminals can be developed according to document rules , The team will not interfere with each other because they see each other's progress 、 Interact with each other .
To write Mock The rules

stay APIfox in ,Mock Rule templates support rich types
The basic data ( Fix json structure )
{
"code": "0",
"data": {
"name": " Zhang Sanfeng ",
"age": 100
},
"desc": " success "
}
The basic data (Mock Random json structure )
{
"code": "0",
"data": {
"list|20": [{
"name": "@name",
"age": "@integer(2)"
}],
"url": "https://localhost/create"
},
"desc": " success "
}
RESTFUL Logical data
In some scenarios , We may need to according to the input parameter rules of the interface , Add appropriate logic processing before returning data . A simple scenario is the login scenario , The user name and password are required , Determine whether the login is successful . Or , We need to according to the product ID Dynamically return product information , wait .
Now? ,Apifox Of Mock Services provide a solution to this scenario .
In the following example , We used _req.body object , Its meaning is :
When post Request for x-www-form-urlencoded perhaps application/json When the method is submitted , We can get the parameter object of the request .
{
"code": "0000", "data": {
"verifySuccess": function() {
let body = _req.body; return body.username === 'admin' && body.password === '123456'; }, "userInfo": function() {
let body = _req.body; if (body.username === 'admin' && body.password === '123456') {
return Mock.mock({
username: "admin", email: "@email", address: "@address" }); } else {
return null; } }, }, "desc": " success "}
obtain Mock Address
- Switch to Mock Environment to test
Click on the quick request directly 
automated testing
Process test is a test for a set of interfaces , Choose the appropriate environment , Can be run as a series of requests .
When you want to automate API When testing , Process testing is very useful .
Create a test process
step :
- New interface , And add assertions
- Open process test , Create a new process
- Add a test interface to the process
- Selection environment , Click to start testing
- View the returned test interface

summary
thus ,Apifox The common core functions have been introduced , but Apifox The power of is not limited to this , In team management 、 Collaborative management 、 Many aspects of project management are excellent , If you haven't used it , It is suggested to try , I believe that after use , Will fall in love with !
download
Official website address :www.apifox.cn
边栏推荐
- What can one line of code do?
- string的底层实现
- 20 large visual screens that are highly praised by the boss, with source code templates!
- PostgreSQL modifies the password of the database user
- GPS from entry to abandonment (XVII), tropospheric delay
- UNI-Admin基础框架怎么关闭创建超级管理员入口?
- Sparkshuffle process and Mr shuffle process
- MySQL - transaction details
- Search map website [quadratic] [for search map, search fan, search book]
- The relationship between root and coefficient of quadratic equation with one variable
猜你喜欢

红杉中国,刚刚募资90亿美元

1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析

Sparkshuffle process and Mr shuffle process

搜素专题(DFS )

【sciter】: 基于 sciter 封装通知栏组件

Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1

Reset Mikrotik Routeros using netinstall
![[Chongqing Guangdong education] Information Literacy of Sichuan Normal University: a new engine for efficiency improvement and lifelong learning reference materials](/img/a5/94bdea3a871db5305ef54e3b304beb.jpg)
[Chongqing Guangdong education] Information Literacy of Sichuan Normal University: a new engine for efficiency improvement and lifelong learning reference materials

Efficiency tool +wps check box shows the solution to the sun problem

GPS从入门到放弃(十二)、 多普勒定速
随机推荐
Leetcode topic [array] -118 Yang Hui triangle
[Yu Yue education] reference materials for surgical skills teaching in Tongji University
关于程序员的职业操守,从《匠艺整洁之道》谈起
【sciter Bug篇】多行隐藏
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
Explain ESM module and commonjs module in simple terms
50个常用的Numpy函数解释,参数和使用示例
Unity3D学习笔记6——GPU实例化(1)
Some problems about the use of char[] array assignment through scanf..
【10点公开课】:视频质量评价基础与实践
华为在多个行业同时出击,吓人的技术让欧美企业瑟瑟发抖
Comparison between multithreaded CAS and synchronized
Earned value management EVM detailed explanation and application, example explanation
Broadcast variables and accumulators in spark
Why rdd/dataset is needed in spark
一行代码可以做些什么?
[asp.net core] set the format of Web API response data -- formatfilter feature
LeetCode学习记录(从新手村出发之杀不出新手村)----1
Microsoft technology empowerment position - February course Preview
C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events