node.jscontentfulcontentful-api

Using 'sys.contentType.sys.id[in]' along with 'order' does not work in Contentful API


I have 3 content models - 'Article', 'Supplier Showcase' and 'Landing page'. Performing search operation with order works when using queries with individual models such as

{
  query: 'PVD',
  content_type: 'article',
  order: 'fields.adminTitle',
  limit: 10,
  skip: 0
} // This works

However, it does not work when used with 'sys.contentType.sys.id[in]'

{
  query: 'PVD',
  'sys.contentType.sys.id[in]': 'article,supplierShowcase,article,landingPage',
  order: 'fields.adminTitle',
  limit: 10,
  skip: 0
} //This does not work - returns empty response

Is there anything that could be done to make this work? Any help would be much appreciated.


Solution

  • You can't sort on specific fields unless you specify exactly one content type in your query.

    From the Contentful documentation:

    Note: When querying entries and using search filters based on fields or ordering by fields you must specify this parameter. You can only specify one value for content_type at a time.