KQL "externaldata" operator fail

Senior Member
KQL code as follow:

let ipdetail=(ip:string) {
    let myurl=strcat('"https://ipapi.co/', ip, '/json"');
    let mydetail=externaldata(detail:string )[h@myurl]with(format="raw");
    mydetail
};
print ipdetail("18.140.16.195")

It fails with:
“Failed to parse the query, no additional information is available. If the issue persists, please open a support ticket. Request id: 7c040878-08b5-4ccc-9154-9f5ece20d362”

Anyone know the reason?
1 Reply

@gfeng 

 

I'm not sure that will do what you need.  You can build the string this way

let ipdetail= (ip:string) { strcat('externaldata(detail:string )[h@"', strcat("https://ipapi.co/",ip,'/json'),'"]with(format="raw")') };
print ipdetail("18.140.16.195")

However the result is the string you built not the result of the execution of the externaldata operator

Clive_Watson_0-1660307284250.png