SOLVED
Home

Extract domain from URL

%3CLINGO-SUB%20id%3D%22lingo-sub-638796%22%20slang%3D%22en-US%22%3EExtract%20domain%20from%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-638796%22%20slang%3D%22en-US%22%3E%3CP%3ETrying%20to%20get%20a%20step%20in%20a%20logic%20app%20that%20will%20extract%20a%20domain%20from%20a%20URL.%26nbsp%3B%20I've%20been%20trying%20to%20find%20a%20way%20to%20do%20this%20with%20the%20data%20operations%20steps%20but%20no%20luck%20yet.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-643682%22%20slang%3D%22en-US%22%3ERE%3A%20Extract%20domain%20from%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-643682%22%20slang%3D%22en-US%22%3EI%20think%20you%20would%20need%20to%20create%20an%20Azure%20function%20that%20does%20what%20you%20need%20to%20do%20and%20call%20that%20from%20your%20Logic%20App%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-650062%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20domain%20from%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-650062%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F306179%22%20target%3D%22_blank%22%3E%40andrew_bryant%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20did%20something%20like%20this%20using%20a%20function%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3Efirst(skip(split(body(%3C%2FSPAN%3E%3CSPAN%3E'Parse_JSON_3'%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3CSPAN%3E%3F%5B%3C%2FSPAN%3E%3CSPAN%3E'id'%3C%2FSPAN%3E%3CSPAN%3E%5D%2C%20%3C%2FSPAN%3E%3CSPAN%3E'%2F'%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3E4%3C%2FSPAN%3E%3CSPAN%3E))%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Efirst%20grabs%20the%201st%20from%20the%20array%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Eskip%20skips%20the%20number%20items%20in%20the%20array%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Esplit%20splits%20on%20deliminator%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Eso%20for%20%3CA%20href%3D%22https%3A%2F%2Fwww.website.com%2Furl%2Fsomething%2Fha%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.website.com%2Furl%2Fsomething%2Fha%3C%2FA%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Eyou%20could%20do%20something%26nbsp%3Blike%20first(skip(split(%22string%22%2C%20'%2F')%2C%202))%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-653285%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20domain%20from%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653285%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20familiar%20with%20Azure%20functions%20and%20I'm%20a%20bit%20lost.%26nbsp%3B%20I've%20created%20a%20function%20and%20gave%20it%20an%20HTTP%20trigger.%26nbsp%3B%20What%20I'm%20not%20sure%20about%20is%20where%20to%20put%20this%20expression%20in%20the%20function%20app.%26nbsp%3B%20Do%20I%20paste%20it%20into%20the%20run.csx%20file%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20assuming%20when%20I%20call%20this%20from%20the%20logic%20app%20the%20HTTP%20request%20will%20contain%20the%20URL%20that%20I%20want%20to%20extract%20the%20domain%20for.%20Is%20there%20anything%20I%20need%20to%20do%20in%20the%20function%20app%20to%20configure%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAndrew%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-654416%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20domain%20from%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-654416%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F306179%22%20target%3D%22_blank%22%3E%40andrew_bryant%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ei%20meant%20a%20function%20in%20Logic%20apps.%26nbsp%3B%20when%20you%20click%20in%20a%20box%20for%20text%20or%20parameter%20you%20can%20add%20dynamic%20content%20(properties%2Foutput%20from%20previous%20steps)%20or%20click%20expression.%26nbsp%3B%20Expression%20has%20functions%20for%20date%2C%20strings%2C%20etc%20etc.%26nbsp%3B%20The%20below%20screen%20shot%20shows%20the%20flyout%20im%20talking%20about.%26nbsp%3B%20in%20this%20example%20i%20typed%20HTTPS%3A%2F%2F%20in%20the%20URI%20paramater%20then%20was%20going%20to%20add%20an%20expression%20after%20that.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F116397iFCA8BA34211C79D4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22lafunction.png%22%20title%3D%22lafunction.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
andrew_bryant
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
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

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies