You need to sign in to do that
Don't have an account?

How to consume third party rest api in salesforce to store data in custom object
Hi, all please help me save response in a custom object.
I have written my code and able to display record in the Visualforce page from rest API endpoint.
please help me to store data in Custom object test__c
Wrapper class
global class Issuerwrap {
public String issuername{get;set;}
public String issuerBankdirName{get;set;}
public String ProcessorName{get;set;}
public String SubprocessorName{get;set;}
}
Controller
public class IssuerCalloutcontroller {
public List<Issuerwrap> IssuerWrapperList{get;set;}
public List<Issuerwrap> getperformcallout(){
IssuerWrapperList= new List<Issuerwrap>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://************End-point *****************');
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
IssuerWrapperList=(List<Issuerwrap>)json.deserialize(res.getbody(),List<Issuerwrap>.class);
}
return IssuerWrapperList;
}
}
VF Page
<apex:page controller="IssuerCalloutcontroller" title="JSON table" readonly="true" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!performcallout}" var="wrap" width="100%">
<!--<apex:column headerValue="Select">
<apex:inputCheckbox value="{!wrap.isSelected}"/>
</apex:column>-->
<apex:column headerValue="Name" value="{!wrap.issuername}"/>
<apex:column headerValue="BankdirName" value="{!wrap.issuerBankdirName}"/>
<apex:column headerValue="ProcessorName" value="{!wrap.ProcessorName}"/>
<apex:column headerValue="SubprocessorName" value="{!wrap.SubprocessorName}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
it's very urgent please help me.
Thanks in advance
I have written my code and able to display record in the Visualforce page from rest API endpoint.
please help me to store data in Custom object test__c
Wrapper class
global class Issuerwrap {
public String issuername{get;set;}
public String issuerBankdirName{get;set;}
public String ProcessorName{get;set;}
public String SubprocessorName{get;set;}
}
Controller
public class IssuerCalloutcontroller {
public List<Issuerwrap> IssuerWrapperList{get;set;}
public List<Issuerwrap> getperformcallout(){
IssuerWrapperList= new List<Issuerwrap>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://************End-point *****************');
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
IssuerWrapperList=(List<Issuerwrap>)json.deserialize(res.getbody(),List<Issuerwrap>.class);
}
return IssuerWrapperList;
}
}
VF Page
<apex:page controller="IssuerCalloutcontroller" title="JSON table" readonly="true" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!performcallout}" var="wrap" width="100%">
<!--<apex:column headerValue="Select">
<apex:inputCheckbox value="{!wrap.isSelected}"/>
</apex:column>-->
<apex:column headerValue="Name" value="{!wrap.issuername}"/>
<apex:column headerValue="BankdirName" value="{!wrap.issuerBankdirName}"/>
<apex:column headerValue="ProcessorName" value="{!wrap.ProcessorName}"/>
<apex:column headerValue="SubprocessorName" value="{!wrap.SubprocessorName}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
it's very urgent please help me.
Thanks in advance
Please go through the below link this might help you.
https://opfocus.com/json-deserialization-techniques-in-salesforce/
Thanks
Plase check once following snippet of code :
Note: If we can specify readonly= "true" in VF. we cannot do DML operations on the controller.so please remove it.
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
I am getting an error when I am saving this controller " IssuerWrapperList variable is not declared"
Please help me.