restful api版本控制
restful api版本控制
1.不适用版本
http://xxx.com/api/user/login
2.不适用版本,直接更好api,新功能使用新的api,老版本使用老api
http://xxx.com/api/user/login
http://xxx.com/api/user/newLogin
3.url加上版本号
http://xxx.com/api/v1/user/login
http://xxx.com/api/v2/user/login
4.url参数带版本号
http://xxx.com/api/v1/user/login?version=1
http://xxx.com/api/v1/user/login?version=2
5.使用请求头来区分版本
http://xxx.com/api/user/login
headers=[X-api-version=1]
http://xxx.com/api/user/login
headers=[X-api-version=2]
6.通过媒体类型进行版本控制
http://xxx.com/api/user/login
headers=[Accept=application/api-v1+json]
http://xxx.com/api/user/login
headers=[Accept=application/api-v2+json]
---------------------------------------------------------------------------
国之殇,未敢忘!
南京大屠杀!
731部队!
以及核污染水排海等一系列全无人性的操作,购买他们的食品和为它们提供帮助只会更加变本加厉的害你,呼吁大家不要购买日本相关产品
昭昭前事,惕惕后人
吾辈当自强,方使国不受他人之侮!
---------------------------------------------------------------------------
作者:三号小玩家
出处:https://www.cnblogs.com/q1359720840/
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。 版权信息