使用Nuxeo Rest Api加载具有属性(急加载)的子项

huangapple go评论59阅读模式
英文:

Loading childrens with properties[Eager Loading] with Nuxeo Rest Api

问题

Sure, here are the translations:

  1. 获取报告文档的基本内容:http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report

  2. 获取报告文档的基本内容以及所有属性:http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?properties=*

  3. 获取报告文档的基本内容以及其所有子文档及其基本内容:http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?enrichers.document=children

  4. 获取报告文档的基本内容以及所有属性,以及其所有子文档及其基本内容:http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?enrichers.document=children&properties=*

现在,我如何才能获取其所有子文档的属性呢?

英文:

> 1) http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report

gives me basic content of Report document

> 2)http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?properties=*

gives me basic+all properties of Report document

> 3)http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?enrichers.document=children

gives me basic content of Report document and all its children document with its basic content

> 4)http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?enrichers.document=children&properties=*

gives me basic+all properties of Report document and all its children document with its basic content

Now how can I get properties of all its children as well?

答案1

得分: 3

我找到了解决方案。我们需要指定 'depth' 标头来控制聚合深度。

尽管文档建议默认情况下深度设置为 children。但对于我来说,明确将 "depth" 设置为 "children""max" 有效。

http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?enrichers.document=children&properties=*&depth=children
英文:

I found the solution.We need to specify 'depth' header to control aggregation depth

Though documentation suggest depth is set to children by default. But for me
specifying "depth" explicitly to "children" or "max" worked

http://host:port/nuxeo/api/v1/path/default-domain/workspaces/Report?enrichers.document=children&properties=*&depth=children

huangapple
  • 本文由 发表于 2020年4月8日 21:01:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/61101321.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定