You need to sign in to do that
Don't have an account?
Nagesh B 13
challenging task, related to HTTP Response. Unable to Proceed
Hi All,
i am new to Integration, i am trying to send a URL by HTTP Request and want to get Image from the Response.
I should update the User Profile pic with that image.
i have excuted below code.
objectname__X iosx=[select Name__c,DownloadUrl__c from Objectname__x WHERE Name__c='logo.jpg'];
String UserIdValue=UserInfo.getUserId();
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(iosx.DownloadUrl__c);
req.setTimeout(60000);
req.setMethod('GET');
req.setHeader('Content-Type', 'image/jpg');
HttpResponse res = h.send(req);
Blob body = res.getBodyAsBlob();
System.debug('response::::' +res.getbody());
In the debug logs, it is printing 'response::::::' in the 1st line and after that line i am able to see below code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<Script>
//some logic relatd to handleRedirect()
</script>
</head>
</html>
<!--Body events--->
<Script type = //some logic>
</script>
</body>
</html>
<!--
------------------------------------------------------
------------------------------------------------------
----------------------------------------------------
---------------------------------------------------
-->
Is any Integration expert please help on this how to proceed forward.
Note: req.setEndpoint(iosx.DownloadUrl__c); in this, the 'DownloadUrl__c' contains string which contains URL. if i take this URL and pasted in the browser and continued , the image is downloading in the local system.
getting no idea, please help on this. Thanks in Advance
i am new to Integration, i am trying to send a URL by HTTP Request and want to get Image from the Response.
I should update the User Profile pic with that image.
i have excuted below code.
objectname__X iosx=[select Name__c,DownloadUrl__c from Objectname__x WHERE Name__c='logo.jpg'];
String UserIdValue=UserInfo.getUserId();
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(iosx.DownloadUrl__c);
req.setTimeout(60000);
req.setMethod('GET');
req.setHeader('Content-Type', 'image/jpg');
HttpResponse res = h.send(req);
Blob body = res.getBodyAsBlob();
System.debug('response::::' +res.getbody());
In the debug logs, it is printing 'response::::::' in the 1st line and after that line i am able to see below code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<Script>
//some logic relatd to handleRedirect()
</script>
</head>
</html>
<!--Body events--->
<Script type = //some logic>
</script>
</body>
</html>
<!--
------------------------------------------------------
------------------------------------------------------
----------------------------------------------------
---------------------------------------------------
-->
Is any Integration expert please help on this how to proceed forward.
Note: req.setEndpoint(iosx.DownloadUrl__c); in this, the 'DownloadUrl__c' contains string which contains URL. if i take this URL and pasted in the browser and continued , the image is downloading in the local system.
getting no idea, please help on this. Thanks in Advance