406 error while connecting to API from Rest source of Copy data activity but works from Web activity and Postman.

Mishra, Swastik 0 Reputation points
2025-04-15T15:24:42.81+00:00

I am facing an issue where the API works from Web activity of Adf pipeline but doesn't work from Rest source of Copy data activity. It was working initially and stopped.

Same API works from web activity and postman.

My API works from Web activity but doesn't work from the Rest Data source of Copy Activity.

It was working initially and after a week when I tried it suddenly it fails with error 406. If I add Http Json data source adding additional headers Content type, Ocp-Apim-Subscription-Key and Authorization with Bearer token is so difficult to format it doesn't work too.

Json data from web activity added separately is also difficult to format and pass to azure sql table.

Failure happened on 'Source' side. ErrorCode=RestCallFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Rest call failed with client error, status code 406 NotAcceptable, please check your activity settings.

Request URL: 8***/.

Response: ,Source=Microsoft.DataTransfer.ClientLibrary,'

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

1 answer

Sort by: Most helpful
  1. Chandra Boorla 14,510 Reputation points Microsoft External Staff Moderator
    2025-04-15T16:31:55.88+00:00

    @Mishra, Swastik

    The issue you're facing is due to the response data being in JSON-LD format (JSON for Linked Data). When using the Copy Data activity with REST source, ADF sets default headers that may not align with what the API expects in terms of content negotiation.

    Root Cause.

    ADF’s Copy Data activity sets default headers like Accept: application/json, which may not align with your API’s requirements. Since your API works in Web Activity and Postman, it's likely expecting a different Accept header—possibly for JSON-LD (application/ld+json) or another specialized format.

    User's image

    For additional information, please refer: Copy and transform data from and to a REST endpoint by using Azure Data Factory

    Resolution.

    To resolve the issue, explicitly configure the required headers in your REST dataset used in the Copy Activity. Here’s what you can try adding in the Request Headers:

    Accept: application/ld+json
    Content-Type: application/ld+json
    Authorization: Bearer <your_token>
    Ocp-Apim-Subscription-Key: <your_key>
    

    This will ensure that ADF requests are compatible with the API’s expected format and prevent the 406 error.

    Make sure:

    • The Authorization value is formatted exactly as: Bearer <token> (with a space).
    • Header names are correctly cased (Content-Type, not contenttype).
    • These headers match what works in Postman or Web Activity.

    Additional considerations:

    If the API returns complex JSON (e.g., JSON-LD), ADF might have trouble flattening it into a tabular format. In that case, consider:

    • Using Web Activity to call the API and save the response to Blob Storage.
    • Then use Mapping Data Flow or Data Flow activity to parse and load into SQL.

    For more details, please refer to the below similar threads for useful insights.

    I hope this information helps. Please do let us know if you have any further queries.

    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    Thank you.


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.