Hammad Hassan Khan
Hammad Hassan Khan

Reputation: 75

how to get a particular field from web activity output in azure data factory

I am trying to create a pipeline where I want to store a particular value from a web activity in azure data factory, in a variable, so that I can pass it to other activities. I want to get the export ID but I keep running into errors. The response of the web activity looks like this:

{
    "requestId": "----",
    "result": [
        {
            "exportId": "---",
            "format": "CSV",
            "status": "Created",
            "createdAt": "2020-12-15T16:03:01Z"
        }
    ],
    "success": true
}

I have tried the following methods but it fails: @string(activity('Web1').output.result.exportId

@string(activity('Web1').output.result[0].exportId

@string(activity('Web1').output.result.[0]

first(@string(activity('Web1').output.result)

enter image description here

enter image description here

Upvotes: 1

Views: 3338

Answers (2)

basilisk f
basilisk f

Reputation: 1

@string(json(activity('Web1').output.response)[0]['Id'])

Upvotes: 0

Steve Johnson
Steve Johnson

Reputation: 8660

I have tried this. Your second expression should work @string(activity('Web1').output.result[0].exportId)

My test

Output of Web activity

enter image description here

These expressions also work fine on my side, you can have a try:

@string(activity('Web1').output['result'][0]['exportId'])
@string(activity('Web1').output.result[0].exportId)
@string(first(activity('Web1').output['result']).exportId)

enter image description here

Upvotes: 1

Related Questions