The correct expression builder syntax in ADF

sam nick 286 Reputation points
2023-04-11T00:53:45.04+00:00

Hello, I am trying to pass this string from ADF (as a source) via an API call, but i cant seem to parse this correctly. The below url works in Postman and i have to send this exactly, with the single , double and colon character. https://endpoint.com/api/search/val?query="created_at:>'2022-01-01' AND created_at:<'2022-02-01'" I tried putting'\ before the single quote , but doesnt work. Any recommendations please.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,753 questions
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,427 Reputation points Microsoft Employee
    2023-04-27T00:25:07.3133333+00:00

    Hi @sam nick ,

    Thanks for using Microsoft Q&A forum and posting your query.

    From the question, I wasn't sure where (linked service or dataset or somewhere else) you are trying to parameterize this, but in general if you would like to form this URL using dynamic expression in pipeline level, then you can try as below to well form the URL.

    @concat('https://endpoint.com/api/search/val?query=created_at:>', '''', '2022-01-01', '''', ' AND created_at:<', '''', '2022-02-01', '''')
    
    

    This will result in below URL : https://endpoint.com/api/search/val?query=created_at:>'2022-01-01' AND created_at:<'2022-02-01`

    Below is sample JSON payload which I used for testing.

    {
        "name": "pipeline13",
        "properties": {
            "activities": [
                {
                    "name": "Set variable1",
                    "type": "SetVariable",
                    "dependsOn": [],
                    "userProperties": [],
                    "typeProperties": {
                        "variableName": "var",
                        "value": {
                            "value": "@concat('https://endpoint.com/api/search/val?query=created_at:>', '''', '2022-01-01', '''', ' AND created_at:<', '''', '2022-02-01', '''')",
                            "type": "Expression"
                        }
                    }
                }
            ],
            "variables": {
                "var": {
                    "type": "String"
                }
            },
            "annotations": []
        }
    }
    

    Hope this info helps. In case if you requirement is different than my understanding, please share few additional details and we will assist accordingly.


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful