Most likely the response is html, either an error page, or login page.
How should json look like to be valid for azure Data factory
Hello,
I have a REST API that send these data when using Advanced Rest Client with method Get
[{"Date":"2022-04-20","GuestNight":"1144","BelaggningLogi":"34,5"},{"Date":"2022-04-21","GuestNight":"1267","BelaggningLogi":"41,0"},{"Date":"2022-04-22","GuestNight":"1193","BelaggningLogi":"39,2"},{"Date":"2022-04-23","GuestNight":"869","BelaggningLogi":"29,5"},{"Date":"2022-04-24","GuestNight":"168","BelaggningLogi":"8,7"},{"Date":"2022-04-25","GuestNight":"172","BelaggningLogi":"9,8"},{"Date":"2022-04-26","GuestNight":"168","BelaggningLogi":"9,7"}]
The REST API is done in .NET/C#
The endpoint look like this in C#
public ActionResult Reservations(string start, string end)
{
DbApi dbApi = new DbApi(Configuration);
dbApi.GetGuestNights(start, end);
IEnumerable<Booked> bookedList = dbApi.GetLodgingOccupancy(start, end);
var json = JsonSerializer.Serialize(bookedList);
return Ok(json);
}
When I use Azure Data Factory and request the REST API I get the following response error back. When I get a valid resonse I will just send the output to a json file.
{
"Code": 21155,
"Message": "Failure happened on 'Source' side. ErrorCode=JsonInvalidDataFormat,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Error occurred when deserializing source JSON file ''. Check if the data is in valid JSON object format.,Source=Microsoft.DataTransfer.ClientLibrary,'",
"EventType": 0,
"Category": 5,
"Data": {
"FailureInitiator": "Source"
},
"MsgId": null,
"ExceptionType": null,
"Source": null,
"StackTrace": null,
"InnerEventInfos": []
}
I call the REST API like this
The response I get back when I use Advanced Rest Client is a valid json so why can't azure Data factory understand the json it get back
Thank in advance
Tony Johansson