You need to sign in to do that
Don't have an account?
Tanya Shah
Image showing null in response
I'm trying to show image through API . But the image doesnt show up on page . With debugging it is showing image as null . Am i missing something or doing wrong ? Please help.
Thank you !
Apex
Thank you !
Apex
public class RestImage { public Blob image {get;set;} public string code {get;set;} public string values {get;set;} public void myConnection(){ http p =new http(); httprequest req= new httprequest(); req.setEndpoint('https://s3.amazonaws.com/soap'); req.setMethod('GET'); req.setTimeout(11000); httpresponse res= p.send(req); code=res.getStatus(); values=res.getBody(); image=res.getBodyAsBlob(); // image=EncodingUtil.base64encode(res.getBodyAsBlob()); System.debug(res.getBody()); System.debug(image); } }Visualforce
<apex:page controller="RestImage" action="{!myConnection}"> {!code}{!values} <apex:form > {!image}</apex:form> <apex:image value="data:image/gif;base64,{!image}" /> </apex:page>
2) if you have not added the domain to remote site settings add it.
https://developer.salesforce.com/page/Amazon_Toolkit