Rest 搜索与特定名称值匹配的子项
描述如何使用Rest 搜索与特定名称值匹配的子项,rest,postman,sitecore9,Rest,Postman,Sitecore9,描述如何使用restfulapi(通过PostMan)检索项目(即时)子项目并在Sitecore9中搜索 它似乎没有说明如何组合这些查询 我想搜索路径指定的项的子项。因此,目前,我返回了一个项目: GET https://{{sitecorehost}}/sitecore/api/ssc/aggregate/content/Items('{{sitecorehome}}/banners-tests')?sc_apikey={{sitecore-master-apikey}} 我还将返回该项目的
restfulapi
(通过PostMan
)检索项目(即时)子项目并在Sitecore9
中搜索
它似乎没有说明如何组合这些查询
我想搜索路径指定的项
的子项
。因此,目前,我返回了一个项目:
GET https://{{sitecorehost}}/sitecore/api/ssc/aggregate/content/Items('{{sitecorehome}}/banners-tests')?sc_apikey={{sitecore-master-apikey}}
我还将返回该项目的子项目:
GET https://{{sitecorehost}}/sitecore/api/ssc/aggregate/content/Items('{{sitecorehome}}/banners-tests/Subcontent/Image and Texts')/Children?sc_apikey={{sitecore-master-apikey}}
但是,由于这些子项不是直接子项-它们位于/subcent/Image和text
的下两级-我无法请求它们。是的,我可以搜索它们,但任何项目都会返回匹配条件,我只想搜索该特定路径下的项目
我想要一个,我想,看起来像这样的东西:
GET https://{{sitecorehost}}/sitecore/api/ssc/aggregate/content/Items?sc_apikey={{sitecore-master-apikey}}&$filter=Name eq 'banner' and Path eq 'banners-tests'
或许是这样:
GET https://{{sitecorehost}}/sitecore/api/ssc/aggregate/content/Items('{{sitecorehome}}/banners-tests')/Children?sc_apikey={{sitecore-master-apikey}}&$filter=Name eq 'banner'
但是这些都不起作用。@Matt我们可以根据项目路径进行过滤。例如,将项目路径视为:
- “sitecore/content/home/tenant1/Subcent/Image and Text/neededitem”-需要的一个
- 'sitecore/content/home/tenant1/Subcontent/Image和 text/item1/neededitem/notneededitem'-我们需要排除的一个
let项目=[{
路径:“sitecore/content/home/tenant1/Subcent/Image and Text/neededitem”,
另一个属性:“text-val1”
}, {
路径:“sitecore/content/home/tenant1/Subcent/Image and Text/item1/neededitem/notneededitem”,
另一个属性:“text-val2”
}];
const results=items.filter(item=>{
const splittedPath=item.Path.split('图像和文本');
if(splittedPath[1].split(“/”).length谢谢。我想你已经在最后一段回答了我的问题(我想要的是不可能的)我没有使用C#在这里,我使用Postman直接通过rest api提交请求。如果我错过了,很抱歉;我已经编辑了这个问题。如果我错了,请纠正我,但我相信您告诉我的是客户端(在您的情况下,基于javascript)正在执行检索子项所需的多个调用,客户端本身执行这些子项的筛选。我希望api能够提供子内容本身。以前的api调用只返回一个级别的子项,现在使用最新的Sitecore版本,它返回所有子项。我想使用parent作为端点中的参数,但由于没有本地实例,因此以过滤逻辑结束。我如何构造GET-restful调用以返回路径的所有子节点?@MattW我相信我们可以在javascript中使用Axios/fetch,然后使用GET端点,其中项路径可以是面向配置的。这是否回答了问题在…上