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

Invocable method to get record and store the response in wrapper

Hi All,

I am new to Salesforce integration. I have to write an invocable method that will get records from an external system. I have endpoint URL and parameter. I want to store the result in wrapper response.
I have tried this but was not able to get the exact code.

public class fetchdetails{
public static List<Results> FetchZillowEstimation(List<Results> address)
    HTTP h = new HTTP();
    HTTPRequest req= new HTTPRequest();
    HTTPResponse res= h.send(req);
    if (res.getStatusCode() == 200) {
            String jsonInput =res.getBody();;
    String jsonInput =res.getBody();
    Map<String,Object> m =(Map<String, Object>) json.deserializeUntyped(jsonInput);

global class Results{
global decimal name;

Harshad ChauhanHarshad Chauhan
String jsstring='{"FRAPI":{"STATUS":"0","MSG":" ","ACCOUNTLIST":{"ACCOUNT":[{"ACCOUNTID":"1083302481D3","ACCOUNTNAME":"Teddy Roosevelt","DEFAULTDATE":"20121231"},{"ACCOUNTID":"119334261AD3","ACCOUNTNAME":"Stephen King","DEFAULTDATE":"20121231"}]}}}';

system.debug((cls_FRAPI) System.JSON.deserialize(jsstring, cls_FRAPI.class));

    public class ACCOUNT {
        public String ACCOUNTID;
        public String ACCOUNTNAME;
        public String DEFAULTDATE;

    public class cls_FRAPI {
        public FRAPI FRAPI;

    public class ACCOUNTLIST {
        public List<ACCOUNT> ACCOUNT;

    public class FRAPI {
        public String STATUS;
        public String MSG;

That should help