DataExplorer::ValidationError:缺少类型为 string 的参数 end_date

我正在尝试通过 API 运行数据探索器查询,但不知为何却收到了缺少参数的错误?

请求中确实包含了该参数:
POST /community/admin/plugins/explorer/queries/2/run?end_date=2020-5-15&duration_days=30

但我仍然收到以下错误:“DataExplorer::ValidationError: 缺少类型为字符串的参数 end_date”。

有人知道问题出在哪里吗?

1 个赞

请查看本主题中的示例:https://meta.discourse.org/t/how-to-run-data-explorer-queries-with-the-discourse-api/120063。第一个代码示例展示了如何在请求中传递 Data Explorer 参数。

2 个赞

啊,我明白了,我需要将 HTTP 参数放在一个名为 param 的参数中传递。为什么不直接传递所有 HTTP 参数给后端,这样调用方就可以使用标准的 HTTP 参数了呢?把参数命名为 param 感觉有点奇怪。

2 个赞