function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Felix Jong Seok ChaeFelix 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.
 
//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);
      }

 
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Felix,

May I suggest you please refer the below link for reference on fetching data from rest API. Hope it will be helpful.

Please mark it as best answer if the information is informative.

Thanks
Rahul Kumar