+ Start a Discussion
rupesh ranjanrupesh ranjan 

Not Geting any value for API call

<apex:pageBlockTable value="{!performcallout4}" var="wrap" width="100%">

<apex:column headerValue="Subject" value="{!wrap.Subject}"/>

<apex:column headerValue="Video Title" value="{!wrap.SessionTitle}"/>
<apex:column headerValue="Sent Date" value="{!wrap.SentDate}"/>
<apex:column headerValue="Subject" value="{!wrap.Subject}"/>
<apex:column headerValue="Sent Date" value="{!wrap.SentDate}"/>

<apex:column headerValue="Recipients" value="{!wrap.NoOfContacts}"/>
<apex:column headerValue="Opens" value="{!wrap.OpenTimes}"/>
<apex:column headerValue="View Count" value="{!wrap.ViewedTimes}"/>
<apex:column headerValue="Part of mail merge?" value="{!wrap.SenderEmail}"/>
</apex:pageBlockTable>


Visualforce Error
Help for this Page
System.AssertException: Assertion Failed: <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="https://www.demomail.net/sf/">here</a>.</h2> </body></html> 

 
public class Contactpage1{
 public Contactpage1(ApexPages.StandardController controller) {
    }
    
public List<contactDemoMailSentwrap> ConsoleWrapperList4{get;set;}
public List<contactDemoMailSentwrap> getperformcallout4(){

ConsoleWrapperList4 = new List<contactDemoMailSentwrap>();

HttpRequest req = new HttpRequest();

HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://www.demomail.net/sf/api/ContactDemoMailSent?Email=twilms@verisign.con&NameSpace=Demos%20On%20Demand%20Report'); 
req.setTimeout(10000);
req.setMethod('GET');

res = http.send(req);
//System.assert(false,res.getBody());
if(res.getstatusCode() == 200){
String replaceIllegal= res.getbody().replaceAll('\n','').replaceAll('\r','');
ConsoleWrapperList4= (List<contactDemoMailSentwrap>)System.JSON.deserialize(replaceIllegal,List<contactDemoMailSentwrap>.class);
System.debug('***********: '+ ConsoleWrapperList4 );
}
return consolewrapperlist4;
}
}

 
sandeep@Salesforcesandeep@Salesforce
Rupesh, 

Here I have implemented same in my org and found thtis error. It is coming because you were asserting a boolean value with  a string. so you can use below instead : 
System.assert(true,boolean.valueof(res.getBody()));

Please try this and mark this as best answer so it helps others also as verified answer.

Thanks
Sandeep Singhal
http://www.codespokes.com/
rupesh ranjanrupesh ranjan
but data are not getting in page block table
rupesh ranjanrupesh ranjan
For retrieving Data Salesforce user must have to login salesforce bcs there are auth from API side.

So how it will retrieve? 
any changes in my code?