You need to sign in to do that
Don't have an account?
Felix Jong Seok Chae
can't fetch some field's value from rest api
I have no problem fetching id of the new case just inserted.
I would like to get description value of that case with the following code, but I failed and received an exception.
I would like to get description value of that case with the following code, but I failed and received an exception.
//Make the request HttpResponse response = httpClient.execute(httpPost); //Process the results int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == 201) { String response_string = EntityUtils.toString(response.getEntity()); JSONObject json = new JSONObject(response_string); // Store the retrieved lead id to use when we update the lead. caseId = json.getString("id"); System.out.println("New case id from response: " + caseId); Description = json.getString("Description"); System.out.println("New case description from response: " + Description); } else { System.out.println("Insertion unsuccessful. Status code returned is " + statusCode); }
May I suggest you please refer the below link for reference on fetching data from rest API.
- https://community.servicenow.com/thread/229368
Hope it will be helpful.Please mark it as best answer if the information is informative.
Thanks
Rahul Kumar