Getting Web Activity Server Response Error Message

TX Aggie 00 26 Reputation points
2022-03-18T17:28:17.903+00:00

We are POSTing some data to an API using the Web Activity in Azure Data Factory v2. Occasionally the server will respond with a non 2xx error. In this particular case, the devs of the API decided to return a generic 400 with a response body of:

{
    "code": "duplicate_parameter",
    "message": "Contact already exist"
}

In this instance, this is a perfectly fine response that I would like to handle by adding an "On Failure" activity and handle appropriately. Unfortunately, there doesn't seem to be a way within ADF to retrieve this message. It can only be seen as an error message on the failed activity monitor. This seems a bit short-sighted. Why would you not include this somewhere in the output JSON for the activity itself in an "error"object?

Maybe I am missing something obvious, in which case, please let me know...

Thanks,
Scott

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,803 questions
0 comments No comments
{count} votes

Accepted answer
  1. HimanshuSinha-msft 19,476 Reputation points Microsoft Employee
    2022-03-22T00:06:04.113+00:00

    Hello @TX Aggie 00 ,
    Thanks for the question and using MS Q&A platform.
    As we understand the ask here is get the content of the error message , please do let us know if its not accurate.
    I did tried to repro on the issue and I had the create an API to and this is what my API return in Postman .
    185378-image.png
    and this is my dummy pipeline .
    185366-image.png
    The below dynam,ic expression is what you are looking for .

    @split(string(activity('Web1').error.message),':')1

    This will output the actual text as
    Output
    {
    "name": "someVariable",
    "value": "\"duplicate_parameter\"}"
    }

    Please do let me if you have any queries.
    Thanks
    Himanshu


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
      • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. TX Aggie 00 26 Reputation points
    2022-03-22T00:17:00.827+00:00

    Thank you very much. I will test and confirm on my end. In the mean time, where can I find the documentation on this.

    Thanks,
    Scott


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.