KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Hi i have to send a get request to an url http://onemoredemo.appspot.com/group?authToken=access_token&authMethod=oauth with request body contains json object as shown below. {"goupid":"some_variable" } Here is a section of java code for sending get request: URL url1=new URL("http://onemoredemo.appspot.com/group?authToken="+access_token+"&authMethod=oauth"); conn=(HttpURLConnection) url1.openConnection(); conn.addRequestProperty("Content-type", "application/x-www-form-urlencoded"); conn.setRequestMethod("GET"); conn.setDoOutput(true); JSONObject jj=new JSONObject(); HttpGet get; get. jj.put("groupid", "testing@iritesh.com"); conn.addRequestProperty("Content-TYpe", "application/json"); conn.getOutputStream().write(jj.toString().getBytes()); conn.connect(); InputStream is=conn.getInputStream(); I am getting an error java.io.FileNotFoundException . I sent a request from mozilla browser to url http://onemoredemo.appspot.com/group?authToken=ya29.AHES6ZRDl-RqiA8W0PhybU_hMluHrHRjlJBvq06Vze0izJq0Ovjc088&authMethod=oauth It was giving me correct response but now its more than one hour so acccesstoken expire. I know its weird to send parameter as well as requestbody in get request but i have to send it. Please help in how to send a json object in request body in get request.
Tags (comma-separated)
Save Edits
Cancel