Function Friday – URI Parsing Functions

Photo by Tima Miroshnichenko from Pexels

Sometimes you need to work with URI (uniform resource identifiers) in Power Automate. URIs point at something, like websites, files, and so forth. You should be familiar with their most common format, the URL (uniform resource locator):

The first portion (“https”) identifies the protocol or scheme. The second portion (“”) points to the domain, or server, where the target is located. And the next portion (“blog”) points to the specific resource on that target server. A URI can also include optional parameters to be passed in. In the example above we’re passing in the parameter “hello” and a value for it of “23”.

There are quite a few different schemes, including the ability for apps to define custom schemes that will allow those apps to respond to URIs themselves.

In Power Automate, there are times when you need to pick apart the various pieces of a URI for use within a flow. Thankfully, the system provides a number of functions to make picking apart a URI and getting its values quite simple.


The uriScheme function will pull out the scheme, or protocol, from the URI. The pattern is simple:


In all of these functions, the URI parameter is a string value and can be passed in hard coded, as a variable, or as the output of a previous action or trigger.


uriScheme('')  // returns 'https'
uriScheme('telnet://')  // returns 'telnet'
uriScheme('file:///c:/temp/test.txt')  // returns 'file'


The uriHost function returns the host value from the URI. In most cases, this will be the server, or domain name, of the target.



uriHost('')  // returns ''
uriHost('telnet://')  // returns ''
uriHost('file:///c:/temp/test.txt')  // returns 'c:'


For URIs where the port to be connected to is not the default port number, then it is added to the host section of the URI. The uriPort function will pull out that value. In the cases where the URI passed in does not have a port, the function will return the default port for that scheme, if there is one.



uriPort('https://localhost:8080/index.html')  // returns '8080'
uriPort('')  // returns '443'


The uriPath function returns the path segment, which is everything after the host and port and before the query portion. This is the segment that points at the actual resource to be accessed.



uriPath('')  // returns '/blog'
uriPath('file:///c:/temp/test.txt')  // returns '/temp/text.txt')


This function will return anything that’s part of the query, if there is one (i.e. anything after the “?” indicator).



uriQuery('')  // returns '?name=barret'


While uriPath and uriQuery return just the path or query segments respectively, the uriPathAndQuery function returns both together.



uriPathAndQuery('')  // returns '/blog?name=barret'


There are a lot of situations where you need to pick out one or more pieces of a URI. This block of functions will help you do just that.

Next week, we’ll delve into the manipulation functions which will let us alter and work with JSON and XML data.

Leave a Reply