I try to hit the API by using HTTPCALL in ECL and it is giving following error.
I have tried hitting it using Postman, its working fine in it. Here is the URL for API - 'https://api.waqi.info/feed/geo:10.3;20.7/?token={token}' and sample code:
IMPORT STD;
EXPORT callAirNow() := FUNCTION
/*
This is a API call from https://aqicn.org/
Web Services API https://aqicn.org/json-api/doc/
*/
Forcast_Rec := RECORD
INTEGER AQI {xpath('aqi')};
END;
resultWrapper := RECORD
DATASET(Forcast_Rec) wrap {xpath('/data')};
END;
URL := 'https://api.waqi.info/feed/geo:10.3;20.7/?token={token}';
MakeCall := HTTPCALL(URL, 'GET', 'application/json', resultWrapper, XPATH('/'));
// Extracting child dataset
RETURN MakeCall.wrap;
END;
output(callAirNow());
Once I removed the XML space encoding, that error message reads as:
Since this URL works for you in Postman, I suggest you submit a JIRA ticket (https://track.hpccsystems.com) to report the issue -- it looks to me like it may be a bug in the jsocket.cpp code that needs squashing.