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
SUMIT BANERJEESUMIT BANERJEE 

How to create record under case usin REST API response

Hi, I have Create REST API class by hitting rest API class using an anonymous window, I am getting response JSON result.
Currently, I am using anonymous window for sending the Input Question, Now I want to map Case object field for Sending Question.

Could anyone guide on this?
This is the class which I have Written, I want to Send data Input data using Case object to this class.
public class SendQuestion{
   public SendQuestion(){}
    
    public void SendQuestionMethod(String inputQue,String dialogId,String accessToken ) {
        HttpResponse res=new HttpResponse();
        HttpRequest req = new HttpRequest(); 

        String jsonsString = '{'+
        '    \"input\" :' +'\"'+inputQue+'\",'+
        '    \"conversation-id\" : null, '+
        '    \"dialog-id\":' +'\"'+dialogId+'\",'+
        '    \"channel\": \"web\",'+
        '    \"access-token\":'+ '\"'+accessToken+'\"'+
        '}';
        System.debug('jsonsString'+jsonsString);
         
        req.setBody(jsonsString);
        req.setMethod('POST');
        req.setEndpoint('https://dialog-----------------');
        req.setHeader('Content-Type', 'application/json');
        req.setTimeout(120000);     
          
        try {
        Http h = new Http();  
        res= h.send(req);
        System.debug('res::>'+res.getBody());      
        } catch(System.CalloutException e) {
            if (res.getStatus()=='OK') {
            system.debug(res.toString());
            } else {
            System.debug('ERROR: '+ e);
            system.debug(res.toString());
            }     
        }
    }
}

Thanks, Sumit
sathishkumar periyasamysathishkumar periyasamy
Sumit, you want to send case record information to external system correct?