socrata - 芝加哥数据门户 API 格式,用于具有多个条件的过滤器
问题描述
可能很容易,但是我在文档中找不到答案。
我有以下 API url,我想用“location_description”的附加过滤条件来扩展它。它目前过滤“住所”:
https://data.cityofchicago.org/resource/6zsd-86xi.json ?$$app_token=xxxxxxxxx&primary_type=BURGLARY&location_description=RESIDENCE
但是,我喜欢将其扩展为包括“公寓,住宅车库”。
所以当我尝试这种格式时:
https://data.cityofchicago.org/resource/6zsd-86xi.json ?$$app_token=xxxxxxxxx&primary_type=BURGLARY&location_description=RESIDENCE,APARTMENT,RESIDENCE-GARAGE
不起作用。
尝试了不同的格式,包括“”,()等,但没有运气。
问题:如何正确格式化此 URL,以便可以过滤多个“location_description”?
感谢您的帮助。
解决方案
为此,使用该where
语句可能会更容易一些,因为它类似于 SQL 查询并且可能更熟悉(并且更容易查看一般查询文档)。现在,我删除了$$app_token
以简化 URL:
https://data.cityofchicago.org/resource/6zsd-86xi.json?$where=primary_type='BURGLARY' AND (location_description='RESIDENCE' OR location_description='APARTMENT' OR location_description='RESIDENCE-GARAGE')
推荐阅读
- javascript - Angular 6 错误 TS8011 类型参数只能在 .ts 文件中使用
- python - 为 SQL 语句准备 Python 元组
- javascript - Node js, mongoose 对数据库中的数据进行排序
- javascript - 如何动态引用对象变量?
- html - 使用 Flex-box 为 Material-UI 制作两个相同高度的网格项
- haskell - Haskell 函数将 Int 转换为 alpha numeration
- java - 是否可以使“标题/列”对表格视图中的行进行分组?
- objective-c - UISegmentedControl 确定当 momentary = YES 时点击哪个按钮
- elixir - 在 Elixir 中的函数调用之间保留变量值
- jquery - 如何在 jquery ajax 中解码 base 64 json 图像?