Forum Discussion
Extract domain from URL
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.
I did something like this using a function
first(skip(split(body('Parse_JSON_3')?['id'], '/'), 4))first grabs the 1st from the arrayskip skips the number items in the arraysplit splits on deliminatoryou could do something like first(skip(split("string", '/'), 2))
4 Replies
- Nicholas DiCola (SECURITY JEDI)Former Employee
I did something like this using a function
first(skip(split(body('Parse_JSON_3')?['id'], '/'), 4))first grabs the 1st from the arrayskip skips the number items in the arraysplit splits on deliminatoryou could do something like first(skip(split("string", '/'), 2))- andrew_bryantBrass Contributor
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
- Nicholas DiCola (SECURITY JEDI)Former Employee
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.
- GaryBusheyBronze ContributorI think you would need to create an Azure function that does what you need to do and call that from your Logic App