Skip to main content
Community site session details

Community site session details

Session Id : FCXqyDv3XSvQUC7tBWnx+K
Power Automate - Building Flows
Answered

Parsing XML response from HTTP Request

Like (0) ShareShare
ReportReport
Posted on 14 Jun 2023 12:40:05 by 13

Hi all, 

 

Long time user, first time poster, as on this occasion I just can't seem to get it working.

 

Hopefully it's an easy solution and I'm just overlooking something simple. I've not really had any experience with XML before today.

 

I have created a cloud flow that calls the HMRC Exchanges Rates website via a HTTP GET request. Calling the API works fine

 

cdawilliams_0-1686744833878.png

 

The flow just repeatedly calls the API, incrementing each time, starting in May 2019 to the present month and year then stops.

 

This is an example of one of the URIs: http://www.hmrc.gov.uk/softwaredevelopers/rates/exrates-monthly-0623.XML

 

cdawilliams_0-1686746340694.png

 

The result is 50 calls with an XML body for each call.

 

The bodies of each call are the same, with the only part changing is the period for which it covers:

 

 

 

<exchangeRateMonthList Period="01/Jun/2023 to 30/Jun/2023">
<exchangeRate>
<countryName>Argentina</countryName>
<countryCode>AR</countryCode>
<currencyName>Peso </currencyName>
<currencyCode>ARS</currencyCode>
<rateNew>291.3043</rateNew>
</exchangeRate>
<exchangeRate>
<countryName>Australia</countryName>
<countryCode>AU</countryCode>
<currencyName>Dollar </currencyName>
<currencyCode>AUD</currencyCode>
<rateNew>1.8915</rateNew>
</exchangeRate>
<exchangeRate>
<countryName>Brazil</countryName>
<countryCode>BR</countryCode>
<currencyName>Real </currencyName>
<currencyCode>BRL</currencyCode>
<rateNew>6.1256</rateNew>
</exchangeRate>
</exchangeRateMonthList>

 

 

It's a very long list so I've only given the first two countries by way of an example of the XML structure.

 

The issue I'm having is parsing each XML response for importing into a SQL table. I've read countless sources from other users having similar issues or tutorials on how to do it, but I'm either hit with an error or not getting the outcome I'm after.

 

cdawilliams_4-1686746195194.png

 

 

 

The below screenshot was from using: 

 

 

xpath(xml(body('HTTP')),'/*[name()="exchangeRateMonthList"]/exchangeRate/countryName')

 

 

 

cdawilliams_2-1686745508832.png

 

The output is usually the above, a long continuous string or I was able to successfully pull out the CountryNames, but only the first countryname from the list, not all of them.

 

What I'm ideally trying to achieve is that for each call is to be able to write the following variables to a sql table:

 

 

Period
countryName
countryCode
currencyName
currencyCode
rateNew

 

 

 

So I end up with a table full of historic exchange rates, for each country, with a field to identify which period it covers, hence the need to include the period field from the XML.

 

I hope this is sufficient information and I fully appreciate any advice in advance.

 

Best regards,

 

Cdaw

  • Verified answer
    cdawilliams Profile Picture
    13 on 14 Jun 2023 at 15:56:33
    Re: Parsing XML response from HTTP Request

    Nevermind - worked it out myself.

     

    Can't see how to remove post so marking as solved.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete