Collections

/api/collections/listCollections

Get all collections

fetch('/api/collections/listCollections?token=xxtokenxx')
    .then(collections => collections.json())
    .then(collections => console.log(collections));

/api/collections/collection/{collectionname}

Get collection schema

fetch('/api/collections/collection/posts?token=xxtokenxx')
    .then(collection => collection.json())
    .then(collection => console.log(collection));

/api/collections/updateCollection/{collectionname}

Update collection schema

fetch('/api/collections/updateCollection/posts?token=xxtokenxx', {
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
            data: {
            fields: [...]
          }
        })
    })
    .then(collection => collection.json())
    .then(collection => console.log(collection));

/api/collections/get/{collectionname}

Get collection entries

fetch('/api/collections/get/posts?token=xxtokenxx')
    .then(res => res.json())
    .then(res => console.log(res));
fetch('/api/collections/get/posts?token=xxtokenxx', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        filter: {published:true},
        fields: {fieldA: 1, fieldB: 1},
        limit: 10,
        skip: 5,
        sort: {_created:-1},
        populate: 1, // resolve linked collection items

        lang: 'de' // return normalized language fields (fieldA_de => fieldA)
    })
})
.then(res=>res.json())
.then(res => console.log(res));

/api/collections/save/{collectionname}

Create / Update collection entries

fetch('/api/collections/save/posts?token=xxtokenxx', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        data: {...}
    })
})
.then(res=>res.json())
.then(entry => console.log(entry));

/api/collections/remove/{collectionname}

Delete collection entries

fetch('/api/collections/remove/posts?token=xxtokenxx', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        filter: {...}
    })
})