回送4复合查询字符串语法

时间:2019-05-10 18:26:21

标签: get axios loopbackjs

我正在尝试使用where过滤器将复合的json查询字符串组合在一起,以访问我的回送API。当简单或语句是查询字符串中的唯一项时,它们就起作用。

https://loopback.io/doc/en/lb4/Parsing-requests.html

作为示例,以下查询字符串将返回两个正确的ID:

http://xxx.xxx.xxx/api/products?filter={"where":{"or":[{"ProductId": "AOC"},{"ProductId": "BCK"}]}}

但是,当我尝试使其变得更复杂(例如,尝试对所有应变类型为“ I”或“ H”的“花朵”产品进行过滤时,会出现400错误:

http://xxx.xxx.xxx/api/products?filter=filter={"where":{"and":[{"ProductType": "flower"},{"or":[{"ProductStrain": "H"},{"ProductStrain": "I"}]}]}}

与:

http://xxx.xxx.xxx/api/products?filter=filter={"where": {"ProductType": "flower"},{"or":[{"ProductStrain": "I"},{"ProductStrain": "H"}]}}

我猜我有一个语法问题,但是我尝试了十多种方法,但仍然没有得到想要的结果。有人可以指出我正确的方向吗?

0 个答案:

没有答案