You need to sign in to do that
Don't have an account?
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
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
Sumit, you want to send case record information to external system correct?