How do you use REST/HTTP with a body as a source in an ADF copy activity?

Viewed 1406

I cannot seem to be be able to use a REST-source with the the body as dynamic content from a previous lookup-activity. The body content in the REST API call will be messed up with "" and "\n" characters. I noticed data factory automatically adds braces to dynamic content:

enter image description here

Removing the braces from the code view results in an error when running the pipeline. I have tested the same API call with a web activity, in which the body will be formatted correctly:

enter image description here

However, I don't know how you can save the response as a file from a web activity. In recap, I want to dynamically pass the Body to a REST API and save the response as a json file. How should this be achieved?

1 Answers

I haven't used this scenario myself, but two things come to mind:

1) Assuming the body needs to be JSON, so you may need to convert the lookup value [which I assume is a string] using the json expression. Something like

@{json(activity('Lookup1').output.value)}

2) Under additional headers, you may need to add an entry to specify Content-Type: application/json

Related