Search code examples
sql-serverrestpostazure-data-factory

What is the proper format of the request 'body' in a Data Factory REST API POST?


I am trying to pull some data using Data Factory from a POST rest API endpoint. When I model it out in postman, everything works great and I get the data back in JSON format the data I wanted. (see clip)

Postman

When I try to convert this info into Data Factory, I'm going nowhere fast:

Data Factory Setup

I've searched and found the Request body formatted multiple ways: eg1

webServiceKey=xxxxxx&requestUserId=xxxx&apiReturnFormat=xxxx&appRequest=xxxx&reserveMinutes=xxxx&departmentId=xxxx&regionId=xx

eg2 - JSON like

{"webServiceKey"="xxxxxx","requestUserId"="xxxx","companyId":"xxxx","apiReturnFormat":"xxxx","appRequest"="xxxx","reserveMinutes":"xxxx","departmentId":"xxxx","regionId":"xxx"}

I've also tried with '=' instead of ':' and a few other combinations. when I use combinations that look similar to eg1, I get access denied error message (on debug and preview). When I use eg2 (and similar), I usually get error messages like:

Check if the data is in valid JSON object format. Unexpected character encountered while parsing value: B. Path '', line 0, position 0.

The headers in postman are also in Data Factory. Anyone know how to correctly format the keys in the ADF Request body so this pipeline pulls data?


Solution

  • I figured it out. I had it right from the beginning. I needed to format the body like this:

    webServiceKey=xxxxxx&requestUserId=xxxx&apiReturnFormat=xxxx&appRequest=xxxx&reserveMinutes=xxxx&departmentId=xxxx&regionId=xx
    

    The issue was that the API admin told me that he entered all the IP addresses that I gave him into his whitelist (including my local IP), but he missed a few of the Azure DF East ranges. Once I realized and he cleaned up his whitelist, I was able to pull data from Data Factory.

    Thanks for the suggestions, John