当前位置:网站首页>A super easy-to-use artifact apifox, throw swagger a few streets... (glory Collection Edition)
A super easy-to-use artifact apifox, throw swagger a few streets... (glory Collection Edition)
2022-07-26 12:33:00 【Dragon back ride Shi】

Catalog
In the final analysis, it is a question of cost
Preface
Hello everyone , I am procedural -- Handong , I'm here again !!
Here's the thing : Some time ago, the company was busy , The back-end partner said that he had finished writing the interface , And shared an interface document to the front end . It's used Swagger UI The interface document generated automatically , Then I went to the information to see the specific situation , Like this :
such Swagger UI Every time I look at the document, my head grows bigger , Lots of problems
When viewing a multi-level model, you need to click open one level at a time
It is very difficult to use when the number of interfaces increases , There is not even a category menu
The submission parameters are JSON Cannot format when
It is troublesome to find out when the parameter is wrong
The returned results cannot be collapsed , Too long to see
Time is urgent , The test is based on the parameters and response data in the document he gave , Written on the front page , After a simple self-test on the front end, it went online in a hurry .
It turned out that I was really hard , It blew up the night after the launch ..

Various interfaces on the page report errors :
Parameter does not exist
Wrong parameter type
Interface does not exist ( Because the interface is written incorrectly )
The boss immediately came to find the cause of the problem , But the front and the back have their own words , It really collapsed :
front end : I'll hang you , How can you share so many errors in the interface ?
Back end : I'll hang you , You can't test whether the interface is normal before you use it ?
front end : Why should I test ? The interface you developed , Your own misfortune ?
Back end : How do I know what kind of data you want to use ! If you test the interface a little , There are so many things ?

In the final analysis, it is a question of cost
At this time, the boss is very calm , Stopped boring quarrels .

The boss analyzed the main cause of the accident :
1、 The back end is sloppy , Some interfaces are not written correctly , Also forgot to debug
2、 Time is tight , The front end did not have time to fully test the interface
Then the boss said , This is, in the final analysis, a cost problem . If The front and rear end test interfaces are particularly simple and convenient , Your problem will not exist !
The online interface documentation you use now , The function is almost zero . You should choose a more powerful online interface documentation tool , You can adjust the interface directly online , Would you not have these problems .
This tool should have the following functions :
Debugging function , The front end can easily debug interface data
Code generation function , In this way, the front end can write less code , Improve efficiency and accuracy
Interface synchronization function , The interface document must be the latest code information
We all nodded , Yeah, yeah .

The eldest son said , I recently tried a tool , Can Zero cost To solve your problems !
Then he showed us a fairy document .
This is this. !!️️️

Why is it called immortal ? Because it is full of the characteristics of being pushed to the limit by cattle , More than usual API The document doesn't know how high it is .

Online debugging
This document is written in Apifox It's done , I have tried this tool before , Completely free and unlimited , I didn't expect that so many powerful new functions have come out recently .
Click... In the upper right corner of the document function Button , Will appear “ The online operation ” Module :
You can directly debug the interface on this interface ! direct 1. Fill in the parameters ,2. Select environment ,3. Point send , The interface request is sent out ! Here is the return result ! There is no need for Postman! Not to mention API Copy it again !

I thought. , If before the launch , It's using Apifox Words , There is simply no accident :
Parameter does not exist ? After online debugging, the data is obtained , Through comparison, we can know which parameter does not exist
Wrong parameter type ? alike , After online commissioning , By comparison , Know which parameter is wrong
Interface does not exist ( Because the interface is written incorrectly )? When debugging, it will be reported that the interface does not exist , Find the back end at the first time ~

Automatic generation
I told the boss , This function looks very powerful . But if the online time is tight , Who has the time to get such an interface document , Configuration should be very troublesome ?
The eldest evil spirit smiled .

He said , This document , yes since ! dynamic ! raw ! become ! Of !
Just put Swagger Of URL Fill in Apifox Go inside ,Apifox It will automatically import API Definition , Then you can generate this useful document !
The back end changes the code randomly , The front end can be debugged online at any time !

and , You can also import from multiple sources Swagger! A set of interface documents from different back-end projects is no problem !

Generate request code
The back-end partner said : It is an online debugging interface , Not to the point of immortality .
The eldest son said , You're still too young .

On this online documentation page , There is also a familiar line icon. What is this ?

since ! dynamic ! raw ! become ! generation ! code !
Click on the corresponding language , You can directly generate the requested code !???
I chose JavaScript after , It also provides Fetch、Axios、Jquery And so on ???

I tried , direct copy Code , Stick it into the code and you can use it ???
An online document , Roll it up like this. As for ???

Generate model code
The eldest son said , Don't worry. , It's not over yet. .

API Documents , There will be one “ Return response ” Module , This is to tell you what type and length of data the backend spits out . The front end writes a data structure to connect these data , Then put it on the page .
In this immortal document ,“ Return response ” There's one in there, too “ The generated code ”.
I ordered , This box pops up :
You can also select the configuration of your generated code on the left , Include : programing language 、 Naming style 、 Verification on wait .
I looked at ,Java,C,C++,JS,Swift,Go,Python,TypeScript…… Basically all the languages I know are .
What's going on ? There is no need to write the code to return the data structure ? Just copy it and paste it ?
I silently rummaged through the automatically generated code , Closed again .
I feel like I wrote it myself Java The code is not as well written as it is automatically generated .

Cloud Mock
I said boss , Oh, I see . I'm going to download it now Apifox, I will use this online document for the next iteration . Oh no , In the next iteration, I will force the backend to use this online document .
The eldest son said , What's the hurry . When I finish . You know, Cloud Mock Do you ?
I said, , Cloud , All immortals want to ride the clouds , This is normal .
The boss said you should be normal . Cloud Mock, Is in the API It is directly implemented on the document page Mock service , A virtual server comes out .
I :???

The eldest son said , such as , We need to ask a bank for API, The bank certainly won't let you ask casually , The number of times to verify the identity limit . Use this Apifox Well , You can request directly on the interface document Mock Data. , It doesn't limit your number of times , I won't charge you any money .
I said boss , Are we jumping a little fast . I can't keep up with you .
The boss said no , We are talking about the features of this online document . You see , Here is the test environment 、 Formal environment and cloud Mock Environmental Science , You just switch to the cloud Mock Environmental Science , The request will be sent to Mock The server , It is the same as the formal environment debugging .
I :!!!!! It can be like this ??
The boss opened this again with a browser URL(https://mock.apifox.cn/m1/1035644-0-default/users/2), Say you see , Direct access URL You can get Mock Data. , Is the front end cool to use ?
I nodded , The leader is right .

This is the time , The back end says , Is it right that we directly put the commonly used third parties API All of them can be made into the cloud Mock Of API file , Then the development can directly debug the third-party interface ? even Mock Servers don't need shelves ?
I : Stunned my little friend .....

API Hub
The eldest son said , You guys ,too young too simple,sometimes naive.

This , be called API Hub.
stay Apifox Inside , These are the most commonly used third parties API It's all done ! Instant messaging , E-commerce , Check the express , Project management , All have ! Each one can The online operation ! The generated code ! You can also clone it into your own project , And then use Cloud Mock! Enterprise wechat API file , It can run online .
The eldest son said , People have made the interface documents public , You should also learn from the interface design of other manufacturers . oh , If our company has an interface to open , You can also publish to this API Hub.
The eldest son said , Okay , I had said . Do you all understand ?
The front-end partner said : I see , Tomorrow, I will go to the back-end line .

The back end says , Wait for what tomorrow ! I'm going to !

Apifox
Last , The boss said in earnest , Young people , We should learn more advanced technologies and tools .
Apifox = Postman + Swagger + Mock + JMeter. Set interface documentation tool 、 Interface Mock Tools 、 Interface automation testing tools 、 Interface debugging tools in one , promote 10 Times R & D efficiency .
Beyond these core functions ,Apifox It also provides a lot of innovation around API Extended features of , It is suitable for development teams of all sizes .
And I think they have an official notice , Later, more powerful document functions will be supported , Include Custom domain name 、 Custom navigation 、 Multi theme style selection 、 Customize css、 Custom page Etc., etc. , You should all pay attention to .

Only when you start , You will reach your ideal and destination , Only when you work hard ,
You will achieve brilliant success , Only when you sow , You will gain something . Only pursue ,
To taste the taste of success , Sticking to yesterday is called foothold , Sticking to today is called enterprising , Sticking to tomorrow is called success . Welcome all friends to praise + Collection !!!
You can see it here , Just click on it. Well .
边栏推荐
- 什么是物联网?常见IoT协议最全讲解
- MySQL之数据查询(聚合函数)
- Ssj-21b time relay
- How do children's playgrounds operate?
- 如何组装一个注册中心?
- Use the jsonobject object in fastjason to simplify post request parameter passing
- 自定义浏览器默认右击菜单栏
- Implementation of dynamic and static libraries (packaging dynamic and static libraries for others to use)
- Oracle AWR 报告脚本:SQL ordered by Elapsed Time
- Backtracking - 46. Full arrangement
猜你喜欢

Use and optimization of MySQL composite index (multi column index)

如何以文本形式查看加密过的信息

QT入门引导 及其 案例讲解

一款超好用的神器Apifox,甩 Swagger 几条街...(荣耀典藏版)

【2243】module_param.m

敲黑板画重点:七种常见“分布式事务”详解

【2243】module_ param.m

Introduction to FPGA (II) - one out of two selector

Customize browser default right-click menu bar

.NET WebAPI 使用 GroupName 对 Controller 分组呈现 Swagger UI
随机推荐
Ssj-21b time relay
Oracle的Windows版本能在linux中使用吗?
回溯——491. 递增子序列
数据查询WHERE
LCD笔记(5)LCD驱动程序框架_使用设备树
What is a callback function? Understanding of the word "back"
QT introduction and case explanation
Access数据库无法连接
How to view encrypted information in text form
“2022华为开发者大赛中国区东部赛区开幕式”在福州成功举办
Pytorch深度学习快速入门教程 -- 土堆教程笔记(一)
Oracle AWR 报告脚本:SQL ordered by Elapsed Time
[Anhui University] information sharing of postgraduate entrance examination and re examination
VS code 设置Ctrl+S保存,自动格式化的方法
酷早报:7月25日Web3加密行业新闻大汇总
基于STM32的SIM900A发送中文和英文短信
Understand test.py in gaitset
Data query where
Data query function
How RFID works