Create a pipeline which sends "Hello World" as POST body to webhook.site.
Trigger pipeline manually.
flowchart LR;
subgraph ADF
w[Web Activity]
end
w -- POST --> webhook.site
As soon as a file is dropped in a folder, send file name to webhook.site
flowchart LR
sa[StorageAccount]
subgraph ADF
t[1. Trigger]
pl[2. Pipeline]
pl --references--> t
end
t --> sa
pl --POST--> webhook.site
Creation:
- Create trigger
- Create pipeline
- Connect pipeline to trigger
To receive file name from trigger
- Add parameter to pipeline - use any name e.g. fn
- Trigger > Edit > Click on 0 Parameters
- Set fn value: @triggerBody().fileName
For folder path, use: @triggerBody().folderPath
To use pipeline parameters in an activity:
For example, to use in Web activity, POST body:
- Click on hyperlink under Body textbox: "Add dynamic content"
- Choose any parameter that you want to use. ADF will auto add: @pipeline().parameters.filename
- Test via webhook.site
References:
- ADF Pipeline Parameters vs Variables: https://stackoverflow.com/a/60838239/2612429
- Parameters: Fixed constants, set once. Usage: pipeline().parameters.{ParamName}
- (so far) Parameters are set by external things e.g. triggers -- just like function parameters are send by its external callers (pipeline is like a function)
- Variables: can be changed. Usage: variables('{VarName}')
- Parameters: Fixed constants, set once. Usage: pipeline().parameters.{ParamName}
- ADF functions e.g. concat two strings: https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#concat
If file name starts with A, then send "Apple" to Webhook.site
If file name starts with B, then send "Banana" to Webhook.site
Steps:
- Create a pipeline
- Create a parameter (filename) for your pipeline
- Connect pipeline to a trigger (which is connected to storage account)
- make sure than filename parameter value is set by trigger. @triggerBody().fileName
- Optional: Create a new pipeline variable (varFileName)
- Use activity: Set Variable, to assign fileName parameter to varFileName
- Add activity: If Condition, and connect it after Set variable
- In activity expression: use function helper links to write this expression
@startswith(variables('varfileName'), 'A')
- Note that this check is case insensitive
- In true, add activity: Web, which makes webhook.site calls with POST body of: Apple
- In true, add activity: Web, which makes webhook.site calls with POST body of: Banana
- Publish. Upload files and observe webhook.site for values.
Create a pipeline, which sends data to webhook.site based on uploaded filename.
Using file name (excluding extension), send a Web request with each part of the filename.
e.g. if file name is abc.txt, send 2 POST requests with body containing abc and txt
if file name is xyz.abc.txt, send 3 POST requests with body containing xyz, abc and txt
Solution:
ForEach Activity takes in an array.
-
Create a variable of type array e.g. parts
-
Assign that variable value based on split of file name by period.
@split(variables('varfn'),'.')
-
ForEach will iterate over the parts variables.
-
Inside ForEach, use a Web activity which uses @item -- which represent current item in loop.