xuxueli / xxl-api Goto Github PK
View Code? Open in Web Editor NEWA api management platform.(API管理平台XXL-API)
Home Page: http://www.xuxueli.com/xxl-api/
License: GNU General Public License v3.0
A api management platform.(API管理平台XXL-API)
Home Page: http://www.xuxueli.com/xxl-api/
License: GNU General Public License v3.0
如题
工程已经成功运行起来了,感觉跟crapapi有点类似,总体感觉更简洁一些。
目前,有个问题请教一下
如何POST一个JSON串?
目前,我增加了一个请求头部:Content-Type application/json;增加了两个请求参数(id,name),分类为JSON类型,提交请求之后,服务器返回异常。
注:使用postman做测试,可以设置raw类型参数,直接贴json串,请求正常返回
必填参数缺少的情况下扔可运行测试
更新方法太粗暴,不支持传部分参数。既然load老数据出来,就对传过来不为空的那些参数进行更新不就很好吗,类似于mybatis的updateBySelective这样的方法.
添加和更新都提供了接口,但详情不加一个接口,蛋疼。想通过http做一下自动化扩展,很难.
暂时未发现header支持自定义header名称
建议项目可以提供排序功能,目前按照默认倒序排列的,希望能加上排序功能,谢谢
目前项目里面大部分都要求生成swagger.json文件,或者ReDoc静态页面,能不能支持swagger文件的导入
例如 GET /job/{id}/detail 获取详情,其中{id}支持动态变化么?
选择的Method是GET,保存后确是POST
重新登录后, 希望能回到登录操作前的页面
不是说导出文档,就是单纯的导出可以自行保存和备份,方便一次性导入或者添加到其他项目
是不是应该对API分配加权限,有些接口是供用的。IOS/安卓/WEB 端用户分别进来看到的接口有些一样,有些不一样。。。这样的楼主有考虑吗?我现在其实也不分什么项目,都是一个APP加WEB 很多接口是共用的,有些又是单独的。就像在上面发布一次接口,给这个人加权限,他就能看到指定接口就行。
(GET)参数为空时测试url功能的转换url方法截取错误
异常信息如下:
2017-07-26 10:22:37,944 - xxl-api - ERROR [com.xxl.api.admin.controller.XxlApiTestController] - <sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target> javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1341) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:153) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868) at sun.security.ssl.Handshaker.process_record(Handshaker.java:804) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:290) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:259) at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:125) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:319) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) at com.xxl.api.admin.controller.XxlApiTestController.remoteCall(XxlApiTestController.java:232) at com.xxl.api.admin.controller.XxlApiTestController.run(XxlApiTestController.java:205) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) at sun.security.validator.Validator.validate(Validator.java:260) at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1323) ... 58 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380) ... 64 more
如图所示,状态码为302,Header中的Location字段未正确显示:
检查发现com.xxl.api.admin.controller.XxlApiTestController
中获取header方法错误
if (statusCode == 302) {
responseContent += ";Redirect地址:" + response.getHeaders("Location");
}
替换为:
if (statusCode == 302) {
responseContent += ";Redirect地址:" + response.getFirstHeader("Location").getValue();
}
保存新的接口之前添加测试该接口的按钮并显示返回的内容
第二个要说的是 在接口列表中增加“测试接口”按钮,少一步进入接口详情页面再点击“接口测试”
有些Api可能需要自定义一些请求头,目前项目里面没看看见自定义的方法,希望可以添加
距离上次 4年了 还能继续更新下去吗 期待啊 宝藏项目
从下拉框里选择测试接口,比如
2.6 获取用户 /user/get
2.x 获取某某 /xx/get
根据选择的接口 必填参数以及参数说明按照新建该接口时输入的内容 默认显示在测试页面,选择不同的接口时清除之前的参数等内容
请问这个项目能以LGPL的方式授权吗?GPL的话公司不太敢用。
XxlApiTestController.java中218行
finalUrl测试值为http://localhost:8084/dataCollection/qryBusinessData?cityCode=531&dateSelect=1&
截取后http://localhost:8084/dataCollection/qryBusinessData?cityCode=531&dateSelect=
建议开发类似swagger的接口文档注解,微服务配置一个文档中心的地址、项目编码等参数,启动自动上报到文档中心,省去文档中心管理平台人工一个一个录入。
就像dubbo rpc接口自动注册到注册中心一样。
这样开发人员只用创建项目分组等信息即可。
感谢作者分享了这个项目,我有个需求想将编写的API导出为HTML或者PDF,因为接口文档是给客户看的,但是我们没有在外网公开API站点,只想提供一份文档给对方,您觉得可以加入这个功能吗?
能否提供Docker镜像,方便我们这些对JAVA不熟的小白
建议加入接口版本管理的功能。。。
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.2</version>
</dependency>
什么时候加个API网关的功能进XXL-API,那就完美了!
项目下下来本地运行报错java.util.zip.ZipException
任何用户都可以删除项目么
1.项目接口可能分前端和移动端调用
2.一个功能模块可能有多个接口
朋友,一个细节问题
每次升级后数据库不需要更新的么...?
比如我之前是1.0.1,这次升级到1.1.0,数据库如何不删除原库更新的...?还是说数据库不需要更新...?
希望可以新增自定义如token的handler ,以及请求body ,可以新增json ,raw等,现在大多都是result风格,谢谢
在测试使用过程中发现无request body输入项,建议加上requestbody的输入项
害我找了半天
类似swagger那样的,或者顶一个直接导出word文档
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.