android - Retorfit 查询参数采用 & 和 ? 一起
问题描述
我必须执行以下 API 调用
网址https://devipapi.octavehi.com/api/state/select-list-items?countryId=236
我创建的改造功能是
@GET("country/state/select-list-items?")
suspend fun fetchStates(@Query("countryId") id: Int): Response<List<ServerState>>
但是我从改造中返回了这个 URL
https://devipapi.octavehi.com/api/country/state/select-list-items?&countryId=236
安培 (&) 与 ?
如何解决这个问题?
解决方案
消除 '?' 来自@GET
@GET("country/state/select-list-items")
suspend fun fetchStates(@Query("countryId") id: Int): Response<List<ServerState>>
推荐阅读
- tensorflow - 无法将 pandas numpy 列转换为张量
- c# - 无法将对象转换为自己的类型
- python - python 字符串列表,替换所有不属于特定子列表的出现
- c - 乘法显式转换不起作用C
- python - 为什么我不能导入任何库?
- google-sheets - 如何设计一个公式(例如 COUNTIF),在多个工作表中搜索参考单元格中文本的部分匹配?
- azure - 如何从 Azure 安排部署在 Azure App Service Web App 上的 Http Post 服务
- active-directory - 添加了新的域控制器,但更改不会复制到现有服务器
- javascript - JavaScript小行星游戏的矢量文本?
- sql-server - 为什么在代码中使用 EF6 connectionString 时出现“System.Data.MetadataException:'无法加载指定的元数据资源。'”错误?