【问题标题】:Select Operator in the Contentful SDK在 Contentful SDK 中选择 Operator
【发布时间】:2019-01-29 15:25:42
【问题描述】:

如何使用 Javascript SDK 中的 Contentful Select Operator,只选择属性:fields?

文档中的GET请求是这样的

GET https://cdn.contentful.com/spaces/<space-id>/entries/?select=fields

【问题讨论】:

    标签: contentful


    【解决方案1】:
    const contentful = require('contentful')
    
    const client = contentful.createClient({
      space: '<space_id>',
      accessToken: '<content_delivery_api_key>'
    })
    
    client.getEntries({
      content_type: '<content_type_id>',
      select: 'sys.id,fields.<field_name>'
    })
    .then((response) => console.log(response.items))
    .catch(console.error)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-07
      • 1970-01-01
      • 2020-08-04
      • 1970-01-01
      • 1970-01-01
      • 2021-10-24
      相关资源
      最近更新 更多