I have a third party API which needs content body in a http GET request and doesn't accept any other forms of input.I cant make any changes to this API and the owners are not taking change requests to the API. I know that this is a bad design and all but is there any way this could be done ? I have tried apache httpurlconnection and java url apis, but haven't been able to achieve the same.
Asked
Active
Viewed 2,305 times
-4
-
1your question is not clear. Please provide more details, show what have you already tried. – DimaSan Sep 02 '16 at 14:33
-
Perhaps [This answer](http://stackoverflow.com/a/27319285/4385713) can be of any help. – Cas Sep 02 '16 at 14:35
-
@cascer1 perhaps not - it uses scala. – xenteros Sep 02 '16 at 14:38
-
1Possible duplicate of [http get request with body](http://stackoverflow.com/questions/27180431/http-get-request-with-body) – talex Sep 02 '16 at 14:51
1 Answers
0
You need to use the below
public class HttpGetWithBody extends HttpEntityEnclosingRequestBase {
@Override
public String getMethod() {
return "GET";
}
}
HttpGetWithBody getWithBody = new HttpGetWithBody ();
getWithBody.setEntity(y(new ByteArrayEntity(
"<SOMEPAYLOAD FOR A GET ???>".toString().getBytes("UTF8"))););
getResponse = httpclient.execute(getWithBody );
Import needed will be org.apache.http.client.methods.HttpEntityEnclosingRequestBase;

Ramachandran.A.G
- 4,788
- 1
- 12
- 24