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

qv7cva1a  于 12个月前  发布在  其他
关注(0)|答案(2)|浏览(137)

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)

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

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?

dfty9e19

dfty9e191#

As per document Json is supported for Both request body and response body. Non-Json values are not supported in request body and request body can be in the form of String (or expression with resultType of string) .

So, try to pas valid Json as key value pair in Request body as below.

{"name":"test","salary":"123","age":"23"}

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

This error usually occurred when the request body and response body is in Non-Json Format.

trnvg8h3

trnvg8h32#

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

相关问题