I have this below URL
In the interface I have as
@GET("storage/presigned-url?bucketName=files&key=payment-receipt/{fileName}&httpVerb=2&contentType=image/jpeg")
suspend fun fileUploadPathCheque(@Path("fileName") name: String): Response<String>
I want to replace the file name with some value
I am calling the function as
Api.fileUploadPathCheque(UUID.randomUUID().toString().plus(".jpg"))
I get the following exception
ava.lang.IllegalArgumentException: URL query string "bucketName=files&key=payment-receipt/{fileName}&httpVerb=2&contentType=image/jpeg" must not have replace block. For dynamic query parameters use @Query.
What shoudl be correct way of doing this?
The exception is self-explanatory, You need to use a query parameter for key
. Something like
@GET("storage/presigned-url?bucketName=files&httpVerb=2&contentType=image/jpeg")
suspend fun fileUploadPathCheque(@Query("key") name: String): Response<String>`
and then call it appending payment-receipt/
to your passing parameter:
Api.fileUploadPathCheque("payment-receipt/" + UUID.randomUUID().toString().plus(".jpg"))
This should work for you.