Probably you are not concatenating the psSurveyID properly.
String input ="{\"survey_id\": p_sSurveyID, \"fields\":[\"url\"]}"; -- not working
should be
String input ="{\"survey_id\":"+ p_sSurveyID+",\"fields\":[\"url\"]}"; -- should work
System.out.println("p_sSurveyID --- " + p_sSurveyID);
try
{
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(new NameValuePair("api_key",p_sApiKey));
URL url = new URL(createUrl(BASE_URL+COLLECTOR_LIST_ENDPOINT,parameters));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "bearer "+p_sAuthToken);
String input ="{\"survey_id\":"+ p_sSurveyID+",\"fields\":[\"url\"]}";
OutputStream os = conn.getOutputStream();
os.write(input.getBytes());
os.flush();
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new RuntimeException("Failed : HTTP error code : " +conn.getResponseCode());
}
BufferedReader br = new BufferedReString input ="{\"survey_id\":"+ p_sSurveyID+",\"fields\":[\"url\"]}";
OutputStream os = conn.getOutputStream();
os.write(input.getBytes()); os.flush();
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new RuntimeException("Failed : HTTP error code : " +
conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream())));
conn.disconnect();
ader(new InputStreamReader( (conn.getInputStream())));
conn.disconnect();