how to send the data to the api from the ADF with content-type application/json

65 Views Asked by At

Hi I want to send the data from a blob file to the API in adf. the data is in json form like this { "Name":"" "Id":"" "data":[{},{}]

}

I have tried the web activity but in web activity I need to provide the body how can I get the content of the file. the file is of 40mb so lookup won't work I tried the rest as sink in copy activity but rest support accept application/json whereas I need content-Type application/json

1

There are 1 best solutions below

1
Pratik Lad On

copy activity but rest support accept application/json whereas I need content-Type application/json

I tried to add header Content-type : application/json in the sink of Rest Api but its throwing error as Content-Type conflicts in AuthHeaders/AdditionalHeaders Is because ADF by default taking header as Content-type : application/json no need to mention explicitly if you blob has Content-type : application/json without this header it worked for me.

how to send the data to the Api from the ADF with content-type application/Json

As the dataset you have is large file around 40 mb but the Lookup activity, web activity can give you the output around 4 mb (It's a limitation of Azure data factory activities). You cannot read that much big data in ADF and call it in Rest Api body.

There are workaround is as below:

  1. Azure Logic app:

Using azure logic app using blob connector you can read the data from Json file and pass it to the rest Api post request to get the desired output. Here the blob connector in logic app has the limit to read and write the data of 50 mb.

  • Take a trigger as when blob is added or updated it will trigger this logic app flow: enter image description here

  • Then take Read blob content action to read the data from blob file. enter image description here

  • Then take HTTP action and pass the response from read blob content to body of http action add your header. enter image description here

Refer this document to read data from blob using logic app