How to post data with REST API dataset as output to Business central

Kayode Ogidan 60 Reputation points
2024-05-07T15:21:14.9333333+00:00

Hello, I am using the copy activity to copy data from a csv containing invoices to a temporary table in Business Central. I am getting this error on the sink side, I set up app registrations and for the Business central. I am using a web activity to get the access token, which works, do I need to pass the token on both the source and the sink side? I did it only on the sink side, and I am still having issues. Please advise

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

Request URL: https://api.businesscentral.dynamics.com/v2.0/be8cd747-0b4b-4f5f-91d5-2c9b3a1b770d/SandboxDev03_28_2024/ODataV4/.

Response: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>,Source=Microsoft.DataTransfer.ClientLibrary,'

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,763 questions
Dynamics 365 Training
Dynamics 365 Training
Dynamics 365: A Microsoft cloud-based business platform that provides customer relationship management and enterprise resource planning solutions.Training: Instruction to develop new skills.
83 questions
{count} votes

Accepted answer
  1. Harishga 4,250 Reputation points Microsoft Vendor
    2024-05-08T08:48:12.2766667+00:00

    Hi @Kayode Ogidan

    Welcome to Microsoft Q&A platform and thanks for posting your question here.

    Regarding the error you are experiencing, as you mentioned, the 401 Unauthorized error states that the server has rejected the credentials provided for the REST API call. This error can occur if the access token is not passed correctly or if the token does not have the necessary permissions.

    To address your questions:

    Passing the Token on Both Source and Sink Side:
    Yes, you generally need to pass the access token on both the source and the sink side in Azure Data Factory. The access token should be included in the header of the API requests to authenticate and authorize the operations.

    Reason for Sink Side Error:
    The error on the sink side could be happening because the access token is not being passed correctly, the token has expired, or the token does not have the correct permissions to write to the sink. Ensure that the token is valid, not expired, and has the necessary permissions for the operations you are trying to perform.

    The response you received states that the credentials (in this case, the access token) provided in the REST API call are incorrect or not authorized. This means that the server is not allowing the operation to proceed because it does not recognize the credentials as valid or sufficient for the requested action.

    Make sure that the access token is being passed correctly in the API call headers and that the token has the required permissions. If you continue to experience issues, you want to test the API call outside of Azure Data Factory using a tool like Postman to ensure that the credentials work as expected. Additionally, reviewing the permissions and settings in Business Central and Azure Data Factory can help identify any configuration issues.

    Reference:
    https://stackoverflow.com/questions/73760418/how-to-pass-bearer-token-api-in-azure-data-factory

    I hope this information helps you. Let me know if you have any further questions or concerns.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful