So I am actually trying to do a PUT with a TypedByteArray as my body. I am interacting with an Azure server, so the first step is to
Make a POST call with my image metadata and I get back a URL (say URL_PUT)
I have to make a PUT request to that URL_PUT (from step 1), so my retrofit singleton interface function looks like:
public interface ImageInterface {
@PUT("/{nothing}")
Response uploadBlob(@Body TypedByteArray byteArray,
@Header("Content-Length") String byteArrayLength,
@Path(value="nothing",encode=false) String nothing);
}
But I get an error saying that URL path must start with an "/" when I pass "" for nothing. For the above function I tried passing an empty string, but to no avail.
So basically I just want to use retrofit with an endpoint but no path/balnk path for PUT. IS there any way to do this ?
How about splitting the URL_PUT?
In example you have http://example.com/path/more/path/image.jpg
You split it in 2 strings: - http//example.com - /path/more/path/image.jpg
Then you get rid of the first "/" of the 2nd Stirng. Then similar as you had:
public interface ImageInterface {
@PUT("/{second-string}")
Response uploadBlob(@Body TypedByteArray byteArray,
@Header("Content-Length") String byteArrayLength,
@Path(value="second-string",encode=false) String secondString);
}
Then on your client use string 1 with this interface. And send string 2 as a parameter. I guess this should work.
(Sorry I typed this so fast, I'm on the move)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With