【问题标题】:Error when trying to hit an API using HTTPCALL in ECL尝试在 ECL 中使用 HTTPCALL 访问 API 时出错
【发布时间】:2022-12-21 09:48:30
【问题描述】:

我尝试通过在 ECL 中使用 HTTPCALL 来访问 API,但它给出了以下错误。

我试过用 Postman 打它,它在里面工作得很好。 这是 API 的 URL - 'https://api.waqi.info/feed/geo:10.3;20.7/?token={token}' 和示例代码:

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());

【问题讨论】:

    标签: hpcc-ecl hpcc


    【解决方案1】:

    删除 XML 空间编码后,该错误消息显示为:

    错误的网络地址 CSocket::pre_connect - 无效/缺少主机 IP 地址 提出于:jsocket.cpp,第 869 行

    由于此 URL 在 Postman 中适用于您,我建议您提交一张 JIRA 票证 (https://track.hpccsystems.com) 来报告该问题——在我看来它可能是 jsocket.cpp 代码中需要压缩的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-16
      • 2020-02-24
      • 2021-10-30
      • 1970-01-01
      • 1970-01-01
      • 2012-07-06
      • 1970-01-01
      • 2012-11-06
      相关资源
      最近更新 更多