# swagger api接口調用指南
系統訪問swagger API地址:[https://demo.mallsuite.cn/api/doc.html](https://demo.mallsuite.cn/api/doc.html)
#### 一:gateway路由配置

上圖為代碼中的gateway配置:

以下為gateway具體配置信息:

gateway訪問端口號: 8201
例如, /mall-account/admin/account/account-user-base/info 通過gateway 默認訪問地址為:ip:8201/admin/account/account-user-base/info {去掉mall-account, gateway路徑配置決定了}
線上,配置的域名訪問的時候,gateway為80端口,并做了一個網址代理映射,未加nginx代理前線上訪問地址為:[https://demo.mallsuite.cn/admin/account/account-user-base/info](https://demo.mallsuite.cn/admin/account/account-user-base/info)
nginx配置截圖:

線上配置代理后,在域名前,配置了一個api,所以[https://demo.mallsuite.cn/admin/account/account-user-base/info](https://demo.mallsuite.cn/admin/account/account-user-base/info)訪問應該改為:[https://demo.mallsuite.cn/api/admin/account/account-user-base/info](https://demo.mallsuite.cn/api/admin/account/account-user-base/info)
#### 二、調用演示說明
線上調用的位置為: 域名/api, 這個是訪問到我們線上演示版gateway的:

可以通過此處,設置默認的gateway方位地址, 不需要每次都修改單獨接口網址了。另外,調用接口需要鑒權,我們可以調用獲得token的接口,如下圖:


下圖為代碼中gateway路徑配置:

請求成功后返回的結果如圖所示:

全局設置 Authorization header,注意:設置token的時候一定要加上Bearer加個空格與token分開,下圖所示:

上圖這兒設置后,刷新下頁面,則所有微服務接口,都會自帶設置好token。
#### 三、實際使用案例
例如,去獲取當前用戶信息, 切換到mall-account服務接口如圖所示:




至此,線上swagger api演示完成