如何查询浮动日期?

时间:2018-05-29 22:40:15

标签: api socrata opendata

我正在查询dataset。从文档中我知道有一个变量disp_date(floating_timestamp)。从documentation开始,我认为我应该可以使用between ... and ...上的disp_date

假设我想从2016-01-01到2016-02-31。我尝试了以下方法:

https://data.brla.gov/resource/4w4d-4es6.json?disp_date between 2016-01-01T00:00:00.000 and 2016-02-01T00:00:00.000

{
  "error" : true,
  "message" : "Unrecognized arguments [disp_date between 2016-01-01T00:00:00.000 and 2016-02-01T00:00:00.000]"
}

1 个答案:

答案 0 :(得分:1)

看起来您在开头时遗漏了$where语句。此外,需要一些日期周围的报价。这对我有用:

https://data.brla.gov/resource/4w4d-4es6.json?$where=disp_date between '2016-01-01T00:00:00.000' and '2016-02-01T00:00:00.000'

使用HTML编码:

https://data.brla.gov/resource/4w4d-4es6.json?$where=disp_date%20between%20%272016-01-01T00:00:00.000%27%20and%20%272016-02-01T00:00:00.000%27