如何使用javascript sdk在包含内容的getEntry调用中包含对象?

Mon*_*key 3 contentful

我看到我可以include:2使用node.js javascript api在getEntries方法中传递查询对象.如何通过getEntry返回单个对象的调用来实现.

// how do I get the nested objects by passing the parameter include:1
client.getEntry('<entry_id>', {<what goes here?>})
.then(function (entry) {
  // logs the entry metadata

})
Run Code Online (Sandbox Code Playgroud)

Cha*_*ieC 6

getEntry返回1,只有1个条目.如果要包含1个父条目(也就是多个条目)的链接条目,则必须使用该getEntries方法并指定sys.id要检索的父条目.像这样:

client.getEntries({'sys.id': '<entry_id>'})
.then(entries => {
  ...
})
Run Code Online (Sandbox Code Playgroud)