Microsoft Flow – HTTP – calling webservices, XML vs JSON

Last week I was asked about making a webservice work in Microsoft Flow. We were using the floatrates url to get some XML back with exchange rates.

So I used the following url: http://www.floatrates.com/daily/gbp.xml

This all worked really well and I got quite quickly some XML back but then the trouble started.

I used XPath to get the bit of XML that I was interested in.

[code lang=text]
xpath(xml(body(‘HTTP’),’/channel/items/title’)
[/code]

 

At first I thought that I got the right data back as I got the right number of items back in my Initialize variable action:

The right number of items yes, but no usable data.  The $content doesn’t look usable anyway.

Then  I tried the json equivalent version of the service and as soon as I started running my flow I know got some json returned by my HTTP action in Flow. So I now started using http://www.floatrates.com/daily/gbp.json instead:

Now all I had to do was use the following Expression:

~~~~
body(‘HTTP’)?[usd]?[rate]

~~~~

and I got my exchange rate back. When using Flow it is a lot easier to use the more modern JSON and XML seems to not be handled properly. SO if you have the choice I would recommend JSON.

 

 

Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

View Comments

  • Good Post .I need your help ,currently i am working with Microsoft flow to connect Azure webhook.I am able to connect and execute the runbook through powerapps button. Now, i am trying to show the same output in powerapps textbox fby retrieving input from Azure runbook. Can anyone help me on the steps for the same ?

Recent Posts

Calculate the Sum for a SharePoint column in Power Automate

Last week Shane Young asked me about calculating the Sum for a SharePoint column in…

3 hours ago

Object must implement IConvertible in Power Apps

In Power Apps when you do a Patch to create a new item or to…

4 days ago

Get started with adaptive cards in Power Automate

Getting started with adaptive cards can be difficult. In this post i have written some…

1 week ago

Create PDF documents from data in Power Automate

In this post I will look at how to create PDF documents from data. Use…

2 weeks ago

Unnest nested arrays in Power Automate

We all know this problem, you have a nested array in Power Automate but how…

3 weeks ago

Advanced settings not loading in Power Platform

Yesterday one of my clients showed me an issues where the Advanced settings didn't load.…

4 weeks ago
%%footer%%