Share via

REST API in ADF

Santhi Dhanuskodi 365 Reputation points
2025-10-27T08:43:58.29+00:00

Hi,

I have to get the data from a REST API(Adpative Planning) which accepts only XML body.

Using copy activity with rest LS dataset is not working. Even though we set the header as 'application/xml' for 'Content-Type'

It throws error

Failure happened on 'Source' side. ErrorCode=JsonInvalidDataFormat,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Error occurred when deserializing source JSON file ''. Check if the data is in valid JSON object format.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=Newtonsoft.Json.JsonReaderException,Message=Unexpected character encountered while parsing value: <. Path '', line 0, position 0.,Source=Newtonsoft.Json,'

The API doesnt have JSON support for now.

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


1 answer

Sort by: Most helpful
  1. Manoj Kumar Boyini 16,895 Reputation points Microsoft External Staff Moderator
    2025-10-27T09:33:33.97+00:00

    Hi Santhi Dhanuskodi,

    Thank you for reaching out to Microsoft QA.
    It sounds like the API you are working with only accepts XML, and you are running into trouble because ADF expects a JSON payload by default.
    Here are some steps to help resolve this:

    1.Check Content-Type Header: You’ve already set the Content-Type to application/xml, which is great. Just double-check that this is configured correctly in both the linked service and the dataset. Sometimes, it’s easy to miss a small configuration detail, and the request might still be treated as JSON.

    2.Copy Activity Limitations: The default Copy Activity in ADF is mainly designed to handle JSON. Since your API expects XML, ADF might not handle it as expected, which could be causing the error. ADF does support REST APIs that return XML, but sending XML as a payload can sometimes cause issues. You might want to test with a custom solution if the Copy Activity doesn’t work.

    3.Use a Custom Activity: If the Copy Activity isn’t working, you can try using a custom solution, like writing an Azure Function or .NET custom activity, that makes the request and handles the XML payload. This will give you more control over the process and ensure that the API gets the request in the right format.

    4.Test with Postman: To rule out any issues with ADF, try sending the same request using Postman or a similar tool. This can help verify if the issue is specific to ADF or if it’s something with the API itself.

    5.Review ADF Logs: Take a look at the logs and monitoring in ADF to see if they provide more information about why the request is failing. This might give us a better idea of what’s going wrong.

    If you can share a bit more about the XML payload you are trying to send or any other error messages you are seeing that will help us troubleshoot further.

    Do let us know if you have questions and concerns.

    Thanks,
    Manoj

    Was this answer helpful?

    0 comments No comments

Your answer

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