我想获得所有在其祖先之间具有特定“ id”的祖先类别的项。
这是 GET 从/categories
返回的类别之一的JSON:
{
"id": "4627f3b0-fe52-4cc6-b03e-3fd72e701342",
"version": 1,
"lastMessageSequenceNumber": 1,
"createdAt": "2019-02-18T13:48:51.677Z",
"lastModifiedAt": "2019-02-18T13:48:51.677Z",
"lastModifiedBy": {
"clientId": "_anonymous"
},
"createdBy": {
"clientId": "_anonymous"
},
"key": "snowboard-gloves",
"name": {
"en": "Snowboard Gloves"
},
"slug": {
"en": "snowboard-gloves"
},
"description": {
"en": "Gloves specifically designed for snowboarding"
},
"ancestors": [
{
"typeId": "category",
"id": "b27086d2-33f2-43c3-aad1-4c01b2b9a886"
}
],
"parent": {
"typeId": "category",
"id": "b27086d2-33f2-43c3-aad1-4c01b2b9a886"
},
"orderHint": "0.000016",
"metaTitle": {
"en": "Snowboard Gloves"
},
"metaDescription": {
"en": "Gloves specifically designed for snowboarding"
},
"assets": []
}
我想用/categories
上的 where 子句调用ancestors[x].id = "b27086d2-33f2-43c3-aad1-4c01b2b9a886"
API,但是从documentation开始,我不知道该怎么写查询谓词。
有人可以帮助我吗?
答案 0 :(得分:1)
查询谓词遵循json响应的结构。嵌套字段使用()括号进行访问。
尝试一下
ancestors(id = "idb27086d2-33f2-43c3-aad1-4c01b2b9a886")
问候 布莱恩