Data Factory Web Activity error on POST

Syed, Umair 45 Reputation points
2025-01-08T06:48:29.2933333+00:00

I am trying to make a POST call to an external API using 'REST' linked service as a source data set and the following request body

{"operator": "","operands": "","type": "expression"}

When I try to do the data preview, I am getting the following error:
Error: at Source 'KonectDatasetExtract': Failure to read most recent page request: DF-REST_001 - Error response from server: Some(), Status code: 415. Please check your request url and body. (url:https://public-api.konectech.com/PROD/api/a34cee66e1054942b7be21b7528ad430/dataset/67877497-e3a3-410c-8ded-a88107c01bbf/page/ast,request body: Some({"operator": "","operands": "","type": "expression"}), request method: POST)
I am using a self-hosted IR and Azure managed VNet. The API works well when I keep the body empty, but when I add the json given above, it throws this error. Also, the same json works well in the postman.
I have also tried using the following with no luck:

  • escape() function with 'json' format
  • ToString() function
  • unescape()
    The code of the data flow is as follows:
    User's image

Error screengrab:
User's image

Please note that if I keep the body empty, I do get a success response like so:
User's image

Success response:
User's image

Is it due to a known bug that is mentioned in Microsoft's official documentation here?

https://learn.microsoft.com/en-us/azure/data-factory/control-flow-web-activity#type-properties
User's image

I have also tried to add additional headers like content-type, accept, content-length and accept-encoding, but I am getting the following error:
at Source 'KonectDatasetExtract': Failure to read most recent page request: Request Failure(URL:https://public-api.konectech.com/PROD/api/a34cee66e1054942b7be21b7528ad430/dataset/67877497-e3a3-410c-8ded-a88107c01bbf/page/ast); Error Message: null; shaded.msdataflow.org.apache.http.client.ClientProtocolException

Screengrab of definition with extra headers:
User's image

Expected response is as follows:
User's image

A prompt response will be much appreciated. Thanks

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. Vinodh247 34,661 Reputation points MVP Volunteer Moderator
    2025-01-09T00:51:19.28+00:00

    Below is a high level walkthrough of common causes and solutions when a ADF web activity fails on a POST request. If your specific error message or configuration differs, adjust as needed:

    1. Check the Request Body Format
      • Ensure your POST body is valid JSON (ex:, properly quoted keys, matching braces).
      • In the Web Activity settings, put your JSON into the “Body” field as a single string or dynamically build it using expressions.
      • Verify you’ve added Content-Type: application/json (or another valid type) in the “Headers” if the endpoint requires JSON.
    2. Authentication & Headers
      • If the endpoint requires a token or a key, supply it in the headers (ex: Authorization: Bearer <token> or x-functions-key if calling an Azure Function).
      • For Basic auth, encode your username and password in the header.
      • Double-check the endpoint’s documentation to confirm how to pass credentials.
    3. Confirm Endpoint Settings
      • Make sure the endpoint (Azure Func, REST API, etc.) supports POST requests at the URL you specified.
      • If the endpoint is private, confirm you’ve configured a Self-Hosted Integration Runtime or the correct VNet integration.
      Diagnostic Steps
      • Test outside ADF: Use a tool like Postman or curl with the exact same body/headers to confirm the endpoint works as intended.
        • Review activity output: Check the “Output” or “Error” messages in ADF for clues (e.g., 401 Unauthorized, 403 Forbidden, 400 Bad Request).
          • Enable logging: On the endpoint side, enable logs (Azure Function logs, API logs) to verify if requests hit the server and whether they fail due to formatting or auth.

    By ensuring the request body is correctly formatted, the headers match what the endpoint expects, and your network/access configuration is correct, you can typically resolve a POST error in your ADF Web Activity. If you still see errors, review the exact status code and error detail from the activity output for more clues.


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.