【发布时间】:2021-08-02 15:09:33
【问题描述】:
我想从 API 获取数据但收到此错误 以下是课程 ID 参数为 5012 的 URL 示例:https://dth.cohota.com/api/v1/calendar_events/?all_events=true&type=assignment&context_codes[]=course_5012
java.lang.IllegalArgumentException:URL 查询字符串“all_events=true&type=assignment&context_codes[]=course_{courseId}”不能有替换块。对于动态查询参数,请使用@Query。
这是我的代码
@GET("calendar_events/?all_events=true&type=assignment&context_codes[]=course_{courseId}")
fun getCourseWithSyllabus(@Query("courseId") courseId: Long): Call<Course>
根据官方文档,我必须使用@Query,我正在使用它,但我也得到了错误。 感谢您的回复。
【问题讨论】:
标签: java android api kotlin retrofit