You need to sign in to do that
Don't have an account?
SFDC developer55
Parse Rest API response
Hi All,
Any idea how can I parse the below Rest API response using Apex code and how can I display this pageblock section.
<bns:QueryResult xmlns:bns="http://api.platform.boomi.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfResults="3">
<bns:result xsi:type="bns:Process" id="XXXXXX" name="AAA"/>
<bns:result xsi:type="bns:Process" id="XXXXXXXX" name="BBBB"/>
<bns:result xsi:type="bns:Process" id="XXXXXX" name="CCC"/>
</bns:QueryResult>
Regards,
PR
Any idea how can I parse the below Rest API response using Apex code and how can I display this pageblock section.
<bns:QueryResult xmlns:bns="http://api.platform.boomi.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfResults="3">
<bns:result xsi:type="bns:Process" id="XXXXXX" name="AAA"/>
<bns:result xsi:type="bns:Process" id="XXXXXXXX" name="BBBB"/>
<bns:result xsi:type="bns:Process" id="XXXXXX" name="CCC"/>
</bns:QueryResult>
Regards,
PR
if(response!=null && response.getBody()!=null)
{
body=response.getBody();
dom=new XMLDom(body);
//for( xmldom.element f: dom.getElementsByTagName('getProcessResponse'))
for( xmldom.element f: dom.getElementsByTagName('QueryResult'))
{
List<string> ids= New List <string> ();
system.debug('here--> dom QueryResult=='+dom.getElementsByTagName('QueryResult'));
for( xmldom.element e: dom.getElementsByTagName('result'))
{
system.debug('here 2--> dom Result=='+dom.getElementsByTagName('result'));
system.debug('here 3--> acc.name=='+ (String)e.getAttribute('name'));
system.debug('here 3--> acc.id=='+ (String)e.getAttribute('id'));