Links
Comment on page

Query Options

limit

Type: number defines the maximum number of documents that the API will return for your query. default: 25 max: 1000
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
limit: 25
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

offset

Type: number defines the number of documents which gets skipped in the datasets. default: 0
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
offset: 0
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

locale

Type: string set the Language for the receiving documents. locale: 'en' to receive all languages, set locale: 'all'
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
locale: 'en'
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

includes

Type: number or Comfortable.Include defines the aggregation level of related documents or pick specific relations which should be aggregated in the query results
Example picking specific relations:
var options = {
includes: new Comfortable.Include()
.add('relatedNews')
}
Example with aggregation level:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
includes: 2 // aggregation level
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

includeTags

Type: array include documents with certain tags to the query results.
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
includeTags: ['include', 'me']
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

excludeTags

Type: array exclude documents with certain tags from the query results.
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
excludeTags: ['exclude', 'this']
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

fields

Type: string hiding/masking specific fields/parts from the query result.
var options = {
fields: 'meta,fields(title,date)'
}
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
fields: 'meta,fields(title)'
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

embedAssets

Type: boolean embeds assets to the document which points on them.
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
embedAssets: true
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

filters

Type: Comfortable.Filter collect or reduce documents by certain field values
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
filters: new Comfortable.Filter()
.addAnd('title', 'like', '%Hello%')
.addAnd('date', 'greaterThan', '2018-07-04')
.addOr('topNews', 'equal', true)
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:

sorting

Type: Comfortable.Sorting sort query results ascending or descending by certain fields
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
sorting: new Comfortable.Sorting()
.add('date', 'asc')
.add('title', 'asc')
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for:
Type: string
Example usage:
const api = Comfortable.api('<repository-api-id>', '<api-key>');
api.getDocuments({
search: 'sport -football +soccer'
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
Available for: