rac3b3nn0n
rac3b3nn0n

Reputation: 881

Azure Data Factory - Content type JSON but response in XML

Apologies if my question is too basic but I'm learning the ropes of Azure, so fairly new ... I need help with the following questions,

I've written a WebActivity which makes a GET request with the following two header values,

I'm expecting a response in JSON but unfortunately it's coming in an XML format. . Please refer to image attached,

Request

GET Request

Request RAW Format

{
"url": "https://someurl.com/data",
"method": "GET",
"headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

}

Response Received Adding some part of response Received,

{
"Response": "<Fleet version=\"1\" snapshotTime=\"2020-06-11T14:46:52Z\" xmlns=\"http://standards.iso.org/iso/15143/-3\"><Links><rel>self</rel><href>https://someurl.com/data</href></Links><Links><rel>first</rel><href>https://someurl.com/data</href></Links><Links><rel>last</rel><href>https://someurl.com/data</href></Links><Equipment><EquipmentHeader><OemName>ENIGMA</OemName><EquipmentId>1021</EquipmentId></EquipmentHeader><Location datetime=\"2020-06-11T12:08:59Z\"><Latitude>52.3292240</Latitude><Longitude>-0.1976080</Longitude></Location><CumulativeOperatingHours datetime=\"2020-06-11T15:02:30Z\"><Hour>5119.03</Hour></CumulativeOperatingHours></Equipment><Equipment><EquipmentHeader><OemName>ENIGMA</OemName><EquipmentId>1025</EquipmentId></EquipmentHeader><Location datetime=\"2020-06-11T13:31:57Z\"><Latitude>52.3170160</Latitude><Longitude>- ...

Can someone help me in understanding if I'm doing something wrong here, using Postman, it works perfectly fine .. I've also tried Azure Logic Apps and get same XML response

Thank you in advance

Upvotes: 0

Views: 716

Answers (1)

Hury Shen
Hury Shen

Reputation: 15734

The Content-Type: application/json means the request body is json type, but the response body doesn't have to be json type. You need to set another property in the header:

Accept: application/json

Hope it helps~

Upvotes: 1

Related Questions