SOLVED

Extract domain from URL

Brass Contributor

Trying to get a step in a logic app that will extract a domain from a URL.  I've been trying to find a way to do this with the data operations steps but no luck yet.

4 Replies
I think you would need to create an Azure function that does what you need to do and call that from your Logic App
best response confirmed by andrew_bryant (Brass Contributor)
Solution

@andrew_bryant 

I did something like this using a function

first(skip(split(body('Parse_JSON_3')?['id'], '/'), 4))
 
first grabs the 1st from the array
skip skips the number items in the array
split splits on deliminator
 
 
you could do something like first(skip(split("string", '/'), 2))

 

 

Not familiar with Azure functions and I'm a bit lost.  I've created a function and gave it an HTTP trigger.  What I'm not sure about is where to put this expression in the function app.  Do I paste it into the run.csx file?

 

I'm assuming when I call this from the logic app the HTTP request will contain the URL that I want to extract the domain for. Is there anything I need to do in the function app to configure this?

 

Thanks,

 

Andrew

@andrew_bryant 

i meant a function in Logic apps.  when you click in a box for text or parameter you can add dynamic content (properties/output from previous steps) or click expression.  Expression has functions for date, strings, etc etc.  The below screen shot shows the flyout im talking about.  in this example i typed HTTPS:// in the URI paramater then was going to add an expression after that.  

 

lafunction.png

1 best response

Accepted Solutions
best response confirmed by andrew_bryant (Brass Contributor)
Solution

@andrew_bryant 

I did something like this using a function

first(skip(split(body('Parse_JSON_3')?['id'], '/'), 4))
 
first grabs the 1st from the array
skip skips the number items in the array
split splits on deliminator
 
 
you could do something like first(skip(split("string", '/'), 2))

View solution in original post