Query

annotation class Query(@Language(value = "http-url-reference") val value: String = KTORGEN_DEFAULT_NAME, val encoded: Boolean = false)

Query parameter appended to the URL

@GET("comments")
suspend fun getCommentsById(@Query("postId") id: String): List<Comment>

getCommentsById(3)
// Generate comments?postId=3
@GET("comments")
suspend fun getCommentsById(@Query("postId") postId: List<String?>): List<Comment>

getCommentsById(listOf("3",null,"4"))
// Generate comments?postId=3&postId=4

A null values are ignored

See also

Properties

Link copied to clipboard
val encoded: Boolean = false

Specifies whether the argument value to the annotated method parameter is already URL encoded

Link copied to clipboard

Name of the query parameter. Default the name of the function parameter.