Forum Discussion

gfeng's avatar
gfeng
Copper Contributor
Aug 12, 2022

KQL "externaldata" operator fail

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?
  • Clive_Watson's avatar
    Clive_Watson
    Bronze Contributor

    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

     



Resources