Azure Data Factory: Web Activity vs HTTP Linked Service: Web can get response from an API, HTTP cannot!

Sam Lohbeck 0 Reputation points
2024-02-12T23:31:46.9533333+00:00

I am currently struggling with a persistent issue in Data Factory.

In the simplest terms, I have an endpoint I'm trying to reach to get a JSON response. Let's call it *"*https://myapi.company.com/attendeeinfo.json**"

I have no authentication headers or anything, the ApiToken and the credentials are being sent inside the POST Body.

When I create a Web Activity (picture for clarity), I plug in all the info, and it works great:
User's image

But when I create an HTTP Dataset and a HTTP Linked Service, (or REST) it breaks-down immediately.

Here is my Linked Service (it successfully test-connects):

User's image

And here is my DataSet:
User's image

Now, when I go to Preview Data, or Import Schema, or any sort of preview feature I get a 400 BadRequest error:
User's image

User's image

Taking a BadRequest for what it is we can assume my JSON formatting is wrong, or something is misspelled or something of the likes of that (I've also tried making the baseUrl end with '/' like it says). But when I copy and paste my body and full URL and plug it into Postman, it works perfectly fine, and I get a response.

I am at a complete loss. Has anybody experienced this before? Am I missing something? Any help would be appreciated!**

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

1 answer

Sort by: Most helpful
  1. Richard Swinbank 527 Reputation points MVP
    2024-02-13T09:47:23.1833333+00:00

    I'm guessing you're creating a dataset prior to configuring a pipeline Copy activity? For copying data the HTTP method (POST) and the POST body are specified in the Copy Activity itself.

    Notice that the dataset has no option to specify a HTTP method or a body. This means that when you try to preview data in the dataset, ADF sends a request, probably GET, without a body. I expect this isn't valid for your web service, which is why you're getting the 400.

    Create the Copy activity in the pipeline and configure its source to use your dataset. You'll then be able to set a request method & body and will be able to preview the dataset there.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.