Reputation: 1
Trying to put a variable in an Azure Data Factory (ADF) API Lookup Activity.
If I put this in the body of my Lookup (variable names changed from real names):
{
"Id": "Blah",
"value": 0,
"peak": 1000,
"filters": {
"StatMin": "1983-09-05",
"StatMax": "2024-04-05",
"ModMin": "1969-10-15",
"ModMax": "2023-10-15"
}
}
The Lookup activity runs perfectly. However, if I try to insert a variable:
{
"Id": "Blah",
"value": 0,
"peak": 1000,
"filters": {
"StatMin": "1983-09-05",
"StatMax": "2024-04-05",
"ModMin": "1969-10-15",
"ModMax": "@variables('Date')"
}
}
I get a pipeline error. What am I doing wrong to format the variable entry properly?
Error below: ErrorCode=HttpRequestFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Http request failed with client error, status code 400 BadRequest, please check your activity settings. If you configured a baseUrl that includes path, please make sure it ends with '/'. Request URL: [REMOVED],Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (400) Bad Request.,Source=System,'
I have tried putting the variable in braces, quotation marks, no quotation marks, etc., and none of them have worked. I thought ADF would read the variable directly like it does in other parts of the pipeline.
Upvotes: 0
Views: 544
Reputation: 11514
To insert the variable in the string, you need to use string interpolation @{<add dynamic content>}
.
Use the expression like below in the lookup body.
{
"Id": "Blah",
"value": 0,
"peak": 1000,
"filters": {
"StatMin": "1983-09-05",
"StatMax": "2024-04-05",
"ModMin": "1969-10-15",
"ModMax": "@{variables('Date')}"
}
}
You can see the variable Date
value in the lookup activity input body.
Upvotes: 0