i want to POST data from android to server side using retrofit2 like : https://192.168.1.1/image?iname=VAR and VAR is variable from the user
interface ModelApi {
@POST("/image")
suspend fun pushImageToModelFromAPI(
@Body file: RequestBody,
)
}
i tried the above code but this doesn't work
CodePudding user response:
For query params you need to use @Query. Like this:
interface ModelApi {
@POST("/image")
suspend fun pushImageToModelFromAPI(
@Body file: RequestBody,
@Query("iname") name: String
)
}