Filters
General Usage
Request using query parameters
Query a collection and apply a filter for a specific field.
https://api.cmft.io/v1/<repo>/collections/<collection>?key=<apiKey>&filters[0][*.fields.rating][equal]=5curl -g 'https://api.cmft.io/v1/<repo>/collections/<collection>?filters[0][*.fields.category][equal]=spaceships' \
-H 'Authorization: <apiKey>'window.fetch('https://api.cmft.io/v1/<repo>/collections/<collection>?filters[0][*.fields.category][equal]=spaceships', {
method: 'get',
headers: {
'Content-Type': 'application/json',
'Authorization': '<apiKey>'
}
})
.then(function (response) { return response.json() })
.then(function (data) {
console.log(data)
})Sample Request
GET https://api.cmft.io/v1/demo/documents?filters[0][*.fields.rating][equal]=5&key=8MIO994Ley6bqyAlQAHqutiDh4g5Heck
Query Parameters
Name
Type
Description
key
string
filters
array
{
"status": 200,
"meta": {
"count": 1,
"limit": 25,
"offset": 0,
"total": 1
},
"data": [
{
"fields": {
"title": "Beautiful Bicycle",
"description": {
"html": "<p>Aluminium Frame; Disc Brakes; Shimano XTR;</p>",
"plain": "Aluminium Frame; Disc Brakes; Shimano XTR;"
},
"price": 1399,
"relatedProducts": [],
"rating": "5",
"inStock": true,
"images": [
{
"meta": {
"id": "969465200912769024",
"contentType": "_asset"
}
}
]
},
"meta": {
"id": "969464870959452160",
"contentType": "products",
"repository": "968388392691830784",
"revision": 4,
"tags": [],
"createdAt": "2018-07-09T12:13:57.000Z",
"updatedAt": "2018-07-09T12:30:01.000Z"
}
}
]
}Request using stringified JSON
Request using JSON POST Body
For large queries that would exceed the length limit of GET request, use the POST method to perform a request.
Using multiple filters in query
Filter documents by content type
Filter documents by tags
Last updated