Skip to content
michael-lefebvre edited this page Apr 7, 2013 · 5 revisions

API - Collection

    GET  - /api/<app-slug>/collection

get all collections from an application, return:

    {
        "total": 3,
        "skip": 0,
        "limit": 999999,
        "results": [
            {
                "digest": [
                    {
                        "path": "title",
                        "label": "title"
                    }
                ],
                "documents": 5,
                "name": "Metatags",
                "namespace": "meta",
                "status": "private",
                "url": "https://tapioca.io/api/acme/collection/meta"
            },
            {
                "digest": [
                    {
                        "path": "title",
                        "label": "title"
                    }
                ],
                "documents": 12,
                "name": "Tour",
                "namespace": "tour",
                "status": "public",
                "url": "https://tapioca.io/api/acme/collection/tour"
            },
            {
                "digest": [
                    {
                        "path": "genre",
                        "label": "genre"
                    },
                    {
                        "path": "season",
                        "label": "saison"
                    },
                    {
                        "path": "title",
                        "label": "titre"
                    }
                ],
                "documents": 7,
                "name": "Saison",
                "namespace": "saison",
                "status": "public",
                "url": "https://tapioca.io/api/acme/collection/saison"
            }
        ]
    }

Specific collection

    CRUD - /api/<app-slug>/collection/<collection-namespace>

return:

    {
        "app_id": "acme",
        "desc": "short description of the collection.",
        "digest": {
            "fields": [
                {
                    "path": "title",
                    "label": "title"
                }
            ],
            "edited": false
        },
        "documents": 12,
        "name": "Tour",
        "namespace": "tour",
        "preview": [
            {
                "label": "article",
                "url": "http://localhost/tapiocapp/demo/public/test?={{previewToken}}"
            },
            {
                "label": "category",
                "url": "http://localhost/tapiocapp/demo/public/test/{{title}}?={{previewToken}}"
            }
        ],
        "revisions": [
            {
                "revison": 1,
                "date": {
                    "sec": 1350725264,
                    "usec": 957000
                },
                "user": "5079459507a7d",
                "status": 100
            },
            {
                "revison": 2,
                "date": {
                    "sec": 1355473251,
                    "usec": 838000
                },
                "user": "5079459507a7d"
            },
        ],
        "status": "public",
        "active": true,
        "revision": 2,
        "cast": [],
        "rules": [
            {
                "path": "/title",
                "rules": [
                    "required"
                ]
            }
        ],
        "schema": [
            ...
        ],
        "hooks":
        {
            "document::before": [
                ...
            ]
        },
        "indexes": [],
        "dependencies": [],
        "template": ""
    }

To get a specific revision of a collection, add the r argument to the URL with the ID of the revision.

    GET  - /api/<app-slug>/collection/<collection-namespace>?r=(int)

Collection's documents summary

get documents summaries from a collection, back office usage only.

    GET  - /api/<app-slug>/collection/<collection-namespace>/abstract

return:

    {
        "total": 12,
        "skip": 0,
        "limit": 999999,
        "results": [
            {
                "_ref": "50b08787c9929",
                "revisions": {
                    "total": 1,
                    "active": {
                        "fr_FR": 1
                    },
                    "list": [
                        {
                            "revision": 1,
                            "date": {
                                "sec": 1353746311,
                                "usec": 825000
                            },
                            "status": 100,
                            "locale": "fr_FR",
                            "user": "5079459507a7d"
                        }
                    ]
                },
                "digest": {
                    "title": "Man have landed on the Moon!"
                }
            },
            {
                "_ref": "50b087bd1614d",
                "digest": {
                    "title": "The Coyote EATS the Road Runner"
                },
                "revisions": {
                    "total": 2,
                    "active": {
                        "fr_FR": 1,
                        "en_UK": 2
                    },
                    "list": [
                        {
                            "revision": 1,
                            "date": {
                                "sec": 1353746365,
                                "usec": 90000
                            },
                            "status": 0,
                            "locale": "fr_FR",
                            "user": "5079459507a7d"
                        },
                        {
                            "revision": 2,
                            "date": {
                                "sec": 1353746394,
                                "usec": 493000
                            },
                            "status": 1,
                            "locale": "en_UK",
                            "user": "5079459507a7d"
                        }
                    ]
                }
            },
            ...
        ]
    }

Clone this wiki locally